Skip to content
Drivn logoDrivn

Dropdown

Composable dropdown menu with dot notation, icons, and click-outside to close.

Preview

Actions
More

Installation

npx drivn add dropdown

Usage

1import { Dropdown } from "@/components/ui/dropdown"
2import { Edit, Trash2 } from "lucide-react"
3
4export default function Page() {
5 return (
6 <Dropdown>
7 <Dropdown.Trigger>Menu</Dropdown.Trigger>
8 <Dropdown.Content>
9 <Dropdown.Item icon={Edit}>
10 Edit
11 </Dropdown.Item>
12 <Dropdown.Item icon={Trash2} destructive>
13 Delete
14 </Dropdown.Item>
15 </Dropdown.Content>
16 </Dropdown>
17 )
18}

API Reference

Dropdown

PropTypeDefaultDescription
align"left" | "right""left"Horizontal alignment of the menu relative to the trigger
classNamestringAdditional CSS classes to apply to the dropdown container
childrenReactNodeDropdown sub-components (Trigger, Content, Item)

Dropdown.Item

PropTypeDefaultDescription
onClick() => voidCallback fired when the item is clicked
iconComponentType | ReactElementIcon component (Edit) or element (<Edit className="..." />)
destructivebooleanApplies destructive styling to the item
childrenReactNodeItem label content

Dropdown.Group

PropTypeDefaultDescription
childrenReactNodeGroup content (Label, Item, Separator)
classNamestringAdditional CSS classes to apply

Dropdown.Label

PropTypeDefaultDescription
childrenReactNodeLabel text content
classNamestringAdditional CSS classes to apply

Dropdown.Separator

PropTypeDefaultDescription
classNamestringAdditional CSS classes to apply