DropdownMenuContent
Loading example…
DropdownMenuContent is part of the Overlays set, imported from @jcsoftdev/ui/overlays.
Import
Section titled “Import”import { DropdownMenuContent } from "@jcsoftdev/ui/overlays";Single-component entry points tree-shake to just this component: @jcsoftdev/ui/overlays/dropdown-menu.
export const Default: Story = { render: (args) => ( <DropdownMenu> <DropdownMenuTrigger asChild> <Button variant="secondary">Acciones de la cita</Button> </DropdownMenuTrigger> <DropdownMenuContent {...args}> <DropdownMenuLabel>Luis Ramírez · 11:30</DropdownMenuLabel> <DropdownMenuItem>Reprogramar</DropdownMenuItem> <DropdownMenuItem>Cobrar S/ 45</DropdownMenuItem> <DropdownMenuItem disabled>Enviar recordatorio</DropdownMenuItem> <DropdownMenuSeparator /> <DropdownMenuItem className="text-danger">Anular cita</DropdownMenuItem> </DropdownMenuContent> </DropdownMenu> ),};Source of the Storybook story.
| Prop | Type | Default | Description |
|---|---|---|---|
container |
HTMLElement | null |
Portal target. Defaults to document.body; pass an element to keep a scoped data-style. |
|
material |
"solid" | "glass" | "glass-clear" | "liquid" | "liquid-clear" |
Surface material. Omitted keeps the default for this layer; "glass" and "glass-clear" are frosted glass, "liquid" and "liquid-clear" Liquid Glass (with its fallbacks), "solid" forces an opaque surface. Liquid options go in style (liquidStyle() f… |
|
bare |
boolean |
false |
Leaves out the panel look (radius, surface, padding, shadow) and keeps only the layering and size limits, so a custom menu (a user card with its own header, say) draws its own surface with className. Positioning, focus handling and keyboard navigation are u… |
forceMount |
boolean |
Keep mounted while closed, for your own animation or measurement. | |
side |
"top" | "bottom" | "left" | "right" |
||
align |
"center" | "end" | "start" |
||
sideOffset |
number |
6 |
Gap between the anchor and the content, in px. |
alignOffset |
number |
Shift along the edge, in px. Follows the reading direction for start/end. |
|
collisionPadding |
Padding |
8 |
Distance kept from the boundary edges. |
collisionBoundary |
Element | (Element | null)[] | null |
Element(s) the content must stay inside, intersected with the viewport. Keep the reference stable. | |
avoidCollisions |
boolean |
Flip and shift to avoid the boundary. Defaults to true. | |
sticky |
"always" | "partial" |
partial keeps the content touching the anchor while shifting. Defaults to partial. |
|
hideWhenDetached |
boolean |
Hide the content while the anchor is scrolled out of the boundary. | |
arrowPadding |
number |
Minimum distance between the arrow and the content corners. | |
dir |
"ltr" | "rtl" |
Reading direction; read from the anchor element when omitted. | |
onOpenAutoFocus |
((event: Event) => void) |
||
onCloseAutoFocus |
((event: Event) => void) |
||
onEscapeKeyDown |
((event: KeyboardEvent) => void) |
||
onPointerDownOutside |
((event: PointerDownOutsideEvent) => void) |
||
onFocusOutside |
((event: FocusOutsideEvent) => void) |
||
onInteractOutside |
((event: InteractOutsideEvent) => void) |
||
intent |
string |
||
intentKey |
string |
* marks a required prop.
It also accepts the native props of the element or primitive it renders (for example className, id, aria-* and event handlers).
Storybook stories
Section titled “Storybook stories”Source
Section titled “Source”packages/ui/src/overlays/dropdown-menu/dropdown-menu.tsx