The responsive actions component allows for the display of actions in a responsive layout. Actions can be presented as persistent, pinned or collapsed to dropdown.
The ResponsiveAction
component is used to declare individual actions within the ResponsiveActions
wrapper. Each action can be displayed as a standalone button or dropdown based on isPinned
and isPersistent
properties. Persistent actions are always separate buttons no matter of the screen size. Pinned actions are rendered as buttons as well, but when the screen size is below the defined breakpoint, they get collapsed to the actions dropdown. Other actions render in a dropdown on all screen sizes.
Examples
Basic responsive actions
This example demonstrates how to create responsive actions with persistent and pinned actions.
Breakpoint on container
By passing in the breakpointReference
property, the overflow menu's breakpoint will be relative to the width of the reference container rather than the viewport width.
You can change the container width in this example by adjusting the slider. As the container width changes, the actions will change their layout despite the viewport width not changing.
Props
ResponsiveAction
Name | Type | Default | Description |
---|---|---|---|
childrenrequired | React.ReactNode | Action label | |
isPersistent | boolean | Determines whether the action should always be displayed as pinned | |
isPinned | boolean | Determines whether the action should be displayed next to dropdown if possible | |
key | string | Key for the action |
ResponsiveActions
Name | Type | Default | Description |
---|---|---|---|
childrenrequired | React.ReactNode | Child actions to be displayed | |
breakpoint | OverflowMenuProps['breakpoint'] | 'lg' | Indicates breakpoint at which to switch between horizontal menu and vertical dropdown |
ouiaId | string | 'ResponsiveActions' | Custom OUIA ID |