ActionBar
ActionBar is a component that is used to display a bottom action bar with a set of actions.
<ActionBar.Root>
<ActionBar.OpenTrigger>
<Button>Open ActionBar</Button>
</ActionBar.OpenTrigger>
<ActionBar.Content>
<Button variant="outline" borderStyle="dashed">
2 Selected
</Button>
<ActionBar.Separator />
<Button startIcon={<TrashIcon />}>Delete</Button>
<Button startIcon={<ShareIcon />}>Share</Button>
<ActionBar.Separator />
<ActionBar.CloseTrigger>
<CloseButton size="md" />
</ActionBar.CloseTrigger>
</ActionBar.Content>
</ActionBar.Root>
Usage
import { ActionBar } from "@yamada-ui/react"
import { ActionBar } from "@/components/ui"
import { ActionBar } from "@workspaces/ui"
<ActionBar.Root>
<ActionBar.OpenTrigger />
<ActionBar.Content>
<ActionBar.Separator />
<ActionBar.CloseTrigger />
</ActionBar.Content>
</ActionBar.Root>
Use props
<ActionBar.Root
content={
<>
<Button variant="outline" borderStyle="dashed">
2 Selected
</Button>
<ActionBar.Separator />
<Button startIcon={<TrashIcon />}>Delete</Button>
<Button startIcon={<ShareIcon />}>Share</Button>
<ActionBar.Separator />
<ActionBar.CloseTrigger>
<CloseButton size="md" />
</ActionBar.CloseTrigger>
</>
}
trigger={<Button>Open ActionBar</Button>}
/>
Change Duration
To change the duration, set duration to a numerical value (seconds).
<ActionBar.Root duration={0.4}>
<ActionBar.OpenTrigger>
<Button>Open ActionBar</Button>
</ActionBar.OpenTrigger>
<ActionBar.Content>
<Button variant="outline" borderStyle="dashed">
2 Selected
</Button>
<ActionBar.Separator />
<Button startIcon={<TrashIcon />}>Delete</Button>
<Button startIcon={<ShareIcon />}>Share</Button>
<ActionBar.Separator />
<ActionBar.CloseTrigger>
<CloseButton size="md" />
</ActionBar.CloseTrigger>
</ActionBar.Content>
</ActionBar.Root>
Change Placement
To change the display position, set placement to "start-center", "end-start", etc. By default, "end-center" is set.
<ActionBar.Root placement="start-center">
<ActionBar.OpenTrigger>
<Button>Open ActionBar</Button>
</ActionBar.OpenTrigger>
<ActionBar.Content>
<Button variant="outline" borderStyle="dashed">
2 Selected
</Button>
<ActionBar.Separator />
<Button startIcon={<TrashIcon />}>Delete</Button>
<Button startIcon={<ShareIcon />}>Share</Button>
<ActionBar.Separator />
<ActionBar.CloseTrigger>
<CloseButton size="md" />
</ActionBar.CloseTrigger>
</ActionBar.Content>
</ActionBar.Root>
Change Animation
To change the show or hide animation, set animationScheme to "block-start", "inline-end", etc. By default, the animation is determined based on the placement.
<ActionBar.Root animationScheme="inline-end" placement="start-end">
<ActionBar.OpenTrigger>
<Button>Open ActionBar</Button>
</ActionBar.OpenTrigger>
<ActionBar.Content>
<Button variant="outline" borderStyle="dashed">
2 Selected
</Button>
<ActionBar.Separator />
<Button startIcon={<TrashIcon />}>Delete</Button>
<Button startIcon={<ShareIcon />}>Share</Button>
<ActionBar.Separator />
<ActionBar.CloseTrigger>
<CloseButton size="md" />
</ActionBar.CloseTrigger>
</ActionBar.Content>
</ActionBar.Root>
Custom Control
const { open, onClose, onOpen } = useDisclosure()
return (
<>
<Button onClick={onOpen}>Open ActionBar</Button>
<ActionBar.Root
content={
<>
<Button variant="outline" borderStyle="dashed">
2 Selected
</Button>
<ActionBar.Separator />
<Button startIcon={<TrashIcon />}>Delete</Button>
<Button startIcon={<ShareIcon />}>Share</Button>
<ActionBar.Separator />
<ActionBar.CloseTrigger>
<CloseButton size="md" />
</ActionBar.CloseTrigger>
</>
}
open={open}
onClose={onClose}
/>
</>
)
"use client" to the top of the file.Props
Accessibility
The ActionBar follows the WAI-ARIA - Dialog (Modal) Pattern for accessibility.
Keyboard Navigation
| Key | Description | State |
|---|---|---|
Escape | Closes the action bar. | open={true} + closeOnEsc={true} |
ARIA Roles and Attributes
| Component | Roles and Attributes | Usage |
|---|---|---|
ActionBar.Content | role="dialog" | Indicates that this is a dialog. |
ActionBar.OpenTrigger | aria-haspopup="dialog" | Indicates that a dialog exists. |
aria-expanded | Sets to "true" if the action bar is open, and "false" if it is closed. | |
aria-controls | If the action bar is open, sets to the id of ActionBar.Content. | |
aria-label | Sets to "Open action bar". | |
ActionBar.CloseTrigger | aria-label | Sets to "Close action bar". |
Similar Components
NativePopover
NativePopover is a component that floats around an element to display information using the HTML Popover API.
Popover
Popover is a component that floats around an element to display information.
Tooltip
Tooltip is a component that displays short information, such as supplementary details for an element.
Drawer
Drawer is a component for a panel that appears from the edge of the screen.
Menu
Menu is a component that displays a common dropdown menu.
Modal
Modal is a component that is displayed over the main content to focus the user's attention solely on the information.