Skip to Content

Built by moveinready.casa  and the community

Shadcn DocsZeego Docs

Dropdown Menu

Displays a menu to the user — such as a set of actions or functions — triggered by a button. Built with Zeego .

Usage

import { DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemIcon, DropdownMenuItemImage, DropdownMenuItemSubtitle, DropdownMenuItemTitle, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu"; import {Button} from "@/components/ui/button"; <DropdownMenu> <DropdownMenuTrigger asChild> <Button>Open menu</Button> </DropdownMenuTrigger> <DropdownMenuContent> <DropdownMenuLabel>My Account</DropdownMenuLabel> <DropdownMenuGroup> <DropdownMenuItem key="profile"> <DropdownMenuItemTitle>Profile</DropdownMenuItemTitle> </DropdownMenuItem> <DropdownMenuItem key="settings"> <DropdownMenuItemTitle>Settings</DropdownMenuItemTitle> <DropdownMenuShortcut>⌘S</DropdownMenuShortcut> </DropdownMenuItem> </DropdownMenuGroup> <DropdownMenuSeparator /> <DropdownMenuCheckboxItem key="notifications" value="on"> Email Notifications </DropdownMenuCheckboxItem> <DropdownMenuSeparator /> <DropdownMenuItem key="logout" variant="destructive"> <DropdownMenuItemTitle>Log out</DropdownMenuItemTitle> </DropdownMenuItem> </DropdownMenuContent> </DropdownMenu>;

Components

PropTypeDefaultDescription
openboolean-Controlled open state of the dropdown menu.
onOpenChange(isOpen: boolean) => void-Callback function called when the dropdown menu open state changes.

Also extends all Zeego DropdownMenu.Root  component props.

PropTypeDefaultDescription
asChildbooleanfalseIf true, merges props with first child element instead of rendering wrapper.
disabledbooleanfalseWhether the trigger is disabled.

Also extends all Zeego DropdownMenu.Trigger  component props.

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the dropdown menu content.
baseClassNamestring-Custom tailwind classes to apply to the base dropdown menu content component. Takes priority over className prop.

Also extends all Zeego DropdownMenu.Content  component props.

Used to group related menu items together.

Extends all Zeego DropdownMenu.Group  component props.

PropTypeDefaultDescription
variant"default" | "destructive""default"The visual variant of the menu item. Controls the color scheme and styling approach.
insetbooleanfalseWhether the item should have inset padding (pl-8).
classNamestring-Additional CSS classes to apply to the dropdown menu item.
baseClassNamestring-Custom tailwind classes to apply to the base dropdown menu item component. Takes priority over className prop.

Also extends all Zeego DropdownMenu.Item  component props.

PropTypeDefaultDescription
checkedboolean-Whether the checkbox is checked.
classNamestring-Additional CSS classes to apply to the dropdown menu checkbox item.
baseClassNamestring-Custom tailwind classes to apply to the base dropdown menu checkbox item component. Takes priority over className prop.
iconClassNamestring-Custom tailwind classes to apply to the check icon.

Also extends all Zeego DropdownMenu.CheckboxItem  component props.

PropTypeDefaultDescription
insetbooleanfalseWhether the label should have inset padding (pl-8).
classNamestring-Additional CSS classes to apply to the dropdown menu label.
baseClassNamestring-Custom tailwind classes to apply to the base dropdown menu label component. Takes priority over className prop.

Also extends all Zeego DropdownMenu.Label  component props.

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the dropdown menu separator.
baseClassNamestring-Custom tailwind classes to apply to the base dropdown menu separator component. Takes priority over className prop.

Also extends all Zeego DropdownMenu.Separator  component props.

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the dropdown menu shortcut text.
baseClassNamestring-Custom tailwind classes to apply to the base dropdown menu shortcut component. Takes priority over className prop.

Also extends all React Native Text component props.

Used to create nested submenu structures.

Extends all Zeego DropdownMenu.Sub  component props.

PropTypeDefaultDescription
insetbooleanfalseWhether the sub trigger should have inset padding (pl-8).
classNamestring-Additional CSS classes to apply to the dropdown menu sub trigger.
baseClassNamestring-Custom tailwind classes to apply to the base dropdown menu sub trigger component. Takes priority over className prop.

Also extends all Zeego DropdownMenu.SubTrigger  component props.

PropTypeDefaultDescription
classNamestring-Additional CSS classes to apply to the dropdown menu sub content.
baseClassNamestring-Custom tailwind classes to apply to the base dropdown menu sub content component. Takes priority over className prop.

Also extends all Zeego DropdownMenu.SubContent  component props.

Used to provide the title text for menu items.

Extends all Zeego DropdownMenu.ItemTitle  component props.

Used to provide subtitle text for menu items.

Extends all Zeego DropdownMenu.ItemSubtitle  component props.

Used to provide icons for menu items.

Extends all Zeego DropdownMenu.ItemIcon  component props.

Used to provide images for menu items.

Extends all Zeego DropdownMenu.ItemImage  component props.

Styling

Variants:

  • default (default) - Standard menu item styling with focus states
  • destructive - Red/destructive styling for dangerous actions

Inset Option:

  • When inset={true}, applies pl-8 padding for alignment with items that have icons

Base Classes:

  • base: relative flex flex-row cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4
  • default: focus:bg-accent focus:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground
  • destructive: text-destructive focus:bg-destructive/10 dark:focus:bg-destructive/20 focus:text-destructive *:[svg]:!text-destructive

Base Classes:

  • base: focus:bg-accent focus:text-accent-foreground relative flex flex-row cursor-default items-center gap-2 rounded-sm py-1.5 pr-2 pl-8 text-sm outline-hidden select-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4
  • icon: pointer-events-none absolute left-2 flex size-3.5 items-center justify-center

Base Classes: px-2 py-1.5 text-sm font-medium flex flex-row

Inset Option: When inset={true}, applies pl-8 padding

Base Classes: bg-border -mx-1 my-1 h-px flex flex-row

Base Classes: text-muted-foreground ml-auto text-xs tracking-widest

Base Classes: focus:bg-accent focus:text-accent-foreground data-[state=open]:bg-accent data-[state=open]:text-accent-foreground flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none

Inset Option: When inset={true}, applies pl-8 padding

Base Classes: bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg

Base Classes: bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 min-w-[8rem] origin-(--radix-dropdown-menu-content-transform-origin) overflow-hidden rounded-md border p-1 shadow-lg

shadcn-native

Built by moveinready.casa  and the community