Dropdown MenuDisplays a menu to the user — such as a set of actions or functions — triggered by a button.
A basic example demonstrating the dropdown menu's appearance and interaction.
Follow these steps to add the dropdown menu component to your project.
Install the component from your command line.
Learn how the dropdown menu is structured and how its parts work together.
Import all parts and piece them together.
Customize the dropdown menu's behavior and appearance with these configuration options.
The
You can add icons to the dropdown items. Supports both leading and trailing icons.
Organize related menu items into sections with descriptive headers.
npm install @raystack/apsara
import { DropdownMenu } from '@raystack/apsara/v1' <DropdownMenu> <DropdownMenu.Trigger asChild> <Button variant="secondary">Dropdown button</Button> </DropdownMenu.Trigger> <DropdownMenu.Content> <DropdownMenu.Item>Item 1</DropdownMenu.Item> <DropdownMenu.Item>Item 2</DropdownMenu.Item> </DropdownMenu.Content> </DropdownMenu>
DropdownMenu
component is composed of several parts, each with their own props:
The button that opens the dropdown menu.
asChild
: Boolean to merge props onto child element
align
: Alignment of the dropdown ("start"
|"center"
|"end"
)sideOffset
: Offset from the trigger (number, default: 4)className
: Additional CSS class names
leadingIcon
: Icon element to display before item text (ReactNode)trailingIcon
: Icon element to display after item text (ReactNode)disabled
: Whether the item is disabled (boolean)className
: Additional CSS class names
className
: Additional CSS class names
className
: Additional CSS class names
className
: Additional CSS class names
children
: React nodes to render in empty stateclassName
: Additional CSS class names
loading...
loading...
loading...