Design system / Molecules
Molecule / Navigation
DropdownMenu
DropdownMenu presents grouped actions and optional checkbox, radio or submenu choices. Radix coordinates focus and selection. The caller binds commands, destinations and selected settings.
Live example
Current component with fictional data. Example changes are not persisted.
No action selected.
Responsibility
Grouped actions and optional setting choices share one menu-selection contract. Consumers supply commands and checked values. A navigation section combining menus, breadcrumbs and identity is classified separately.
Public contract
The table describes supported inputs, exported parts and caller responsibilities. A callback supplies a command, such as saving a draft. These notes are maintained manually; check current source types before integration.
| Prop / part | Type | Requirement | Responsibility |
|---|---|---|---|
| open / defaultOpen / onOpenChange | Radix Root props | Optional | Disclosure can be external or primitive-owned. |
| sideOffset | number | Content · default 4 | Content renders a portal. |
| container | HTMLElement | null | Content · optional | Portal owner for theme inheritance or nested modality; omitted keeps the body portal. |
| showIndicator | boolean | RadioItem · default true | Render the checked glyph and its reserved space. Set false for a segmented presentation; checked semantics remain unchanged. Supply a visible selected treatment. |
| variant / inset | "default" | "destructive" / boolean | Item props | Visual treatment only; destructive does not confirm an operation. |
| checked / onCheckedChange; value / onValueChange | CheckboxItem / RadioGroup primitive props | Optional choices | Consumer owns the selected setting. |
| onSelect / disabled / asChild | Primitive item props | Consumer actions | Callbacks and destinations belong to caller; shortcut text does not register a hotkey. |
API notes are curated documentation, not generated types. The source linked above is the current implementation; update these notes alongside API changes.
State and behavior
Identify which values the caller controls and which behavior the component or underlying primitive owns. A local example does not supply persistence, authorization or a complete product lifecycle.
Radix handles focus, dismissal and menu selection. Consumers execute commands and bind settings; this file does not fetch, authorize or mutate.
Dependencies
- Radix DropdownMenu primitives
- Lucide Check, Circle and ChevronRight
- cn()
Token and styling contract
These notes identify theme roles, utilities and direct style values used by the source. Direct colors or timings are implementation exceptions, not recommendations to bypass the theme.
bg-popover / text-popover-foreground- Menu surface.
bg-accent / text-accent-foreground- Focused item roles.
text-destructive- Optional destructive item variant.
text-md / text-xs / border / bg-border- Items, shortcut text and separator.
Boundaries and limitations
- No automatic command execution, pending or error handling.
- A destructive variant is not a permission or confirmation policy.
Where to make a change
Change shared menu anatomy in dropdownMenu.tsx; action meanings, checked state and destinations stay with consumers. Content accepts an optional container to retain a theme or modal owner. RadioItem owns its indicator through showIndicator; consumers must not hide internal spans with descendant selectors. The default body portal and indicator remain unchanged. Review focus, disabled selection and indirect navigation consumers.
Selected real uses
AuthButton
When a display name is available, it composes an identity trigger, label, separator and sign-out link.
src/components/navigation/authButton.tsxThese traces describe selected uses, not every dependency. Repository-only paths are shown as references; only approved files have public source views.
Usage contract
import { DropdownMenu, DropdownMenuTrigger, DropdownMenuContent, DropdownMenuItem } from "@/components/ui/dropdownMenu";
<DropdownMenu><DropdownMenuTrigger>Actions</DropdownMenuTrigger>
<DropdownMenuContent container={themeContainer}><DropdownMenuItem onSelect={showDetails}>Details</DropdownMenuItem></DropdownMenuContent>
</DropdownMenu>Illustrative consumer bindings, not a self-contained product workflow. Live examples supply only local state or explicit fictional props.