Skip to content
LoidoltTheme 0.11.1
Svelte 5

Component

DropdownMenu

A menu of actions, from an items array or your own snippet.

import { DropdownMenu } from '@loidolt/theme-svelte';

Example

no action selected Grid on · rulers off · by name

Notes

  • Shortcut hints are exposed to assistive tech, not aria-hidden — a shortcut nobody can hear may as well not exist.
  • For checkbox items, radio items, or submenus, drop to the re-exported DropdownMenuPrimitive.
  • items also takes type: 'group' (a heading over rows), 'checkbox' (a toggle, reported through onCheckedChange), 'radio' (one of many, through onValueChange) and 'sub' (a nested menu) entries. Toggles and choices keep the menu open.
  • shortcut sets aria-keyshortcuts and shows as the hint. The menu does not bind the key; your app does.
  • destructive styles an item as danger. Pair it with a confirmation for anything irreversible.

Props

Generated from the component source, so it cannot drift from the implementation.

DropdownMenu props
PropTypeDefaultNotes
align Alignment'start'
children Snippet—Escape hatch: compose the menu body yourself from the re-exported primitives.
class string—class lands on the portaled Content element.
groupLabel string—Heading rendered above items, associated with them via a menu group.
items MenuEntry<T>[][]Declarative rows: plain items, plus type: 'group' | 'checkbox' | 'radio' | 'sub' entries for headings, toggles, one-of-many choices and nested menus. Ignored when children is provided.
onCheckedChange (value: T, checked: boolean) => void—A checkbox entry was toggled. Update its checked in your items.
onOpenChange (open: boolean) => void—
onSelect (value: T) => void—An action row was chosen.
onValueChange (name: string, value: T) => void—A radio group's choice changed. Update its value in your items.
open bindablebooleanfalse
ref bindableHTMLElement | nullnull
side Placement'bottom'
sideOffset number6
trigger Snippet—
triggerChild Snippet<[TriggerChildProps]>—Full control of the trigger element — receives the props Bits needs on it.
triggerClass string'ldt-button ldt-button--quiet'

Plus the attributes of Omit<DropdownMenuContentProps, 'children' | 'class' | 'child'>, forwarded to the root element.