Skip to content
Kappa
Dropdown
@dicehub/kappav0.4.2

Dropdown

Presents a compact, keyboard-accessible list of actions, links, options, and nested menus.

Installation

Barrel

import {
  Dropdown,
  DropdownRoot,
  DropdownContent,
  DropdownItem,
  type DropdownProps,
  type DropdownItemVariant,
} from "@dicehub/kappa";

Granular

import {
  Dropdown,
  DropdownRoot,
  DropdownContent,
  DropdownItem,
  type DropdownProps,
  type DropdownItemVariant,
} from "@dicehub/kappa/components/dropdown";

Usage

Put Trigger and Content inside Dropdown.Root. Give every item a stable, unique value. Handle actions from the rootselect event or from one item. Set valueText when the searchable label must differ from the rendered item text. Checkbox and radio options also need it when their visible label differs from value.

Composition

Typical part hierarchy
Dropdown.Root
├── Dropdown.Trigger
└── Dropdown.Content
    ├── Dropdown.Group
    │   ├── Dropdown.Label
    │   ├── Dropdown.Item
    │   ├── Dropdown.CheckboxItem
    │   └── Dropdown.RadioGroup
    │       └── Dropdown.RadioItem
    ├── Dropdown.Separator
    └── Dropdown.Sub
        ├── Dropdown.SubTrigger
        └── Dropdown.SubContent
            └── Dropdown.Item

Ark UI Menu owns open state, focus, roving highlight, typeahead, selection, dismissal, positioning, nested menus, and ARIA roles. Kappa owns the compound API, portalled surfaces, option state helpers, semantic tokens, dense layout, and motion.

  • Dropdown and Dropdown.Root are the same root component.
  • Content supplies Teleport, Positioner, and the menu surface. Pass :teleport="false" for in-place rendering.
  • Use as-child when a Kappa Button or another semantic element owns the trigger.
  • An as-child element must not add capture-phase handlers that replace Kappa keyboard or disabled behavior.
  • Use LinkItem for navigation. Do not put an anchor inside a normal Item.
  • Pass Root navigate when a client-side router must handle keyboard link activation. Native anchors work without it.
  • Do not set a custom DOM id on Item. Ark UI uses its generated IDs for focus; use value as the stable action key.

Reference Differences

The public name is Dropdown, the danger treatment is nameddestructive to match Kappa Button, and Content owns its portal instead of requiring a separate Portal part. Kappa also adds uncontrolled checkbox and radio defaults, context-trigger support, explicit reduced motion, and forced-colors styles. Root ariaLabel is mirrored to Content because the popup is portalled, and keyboard-opened context menus restore focus after Escape.

Keyboard Navigation

EnterSpaceOpen the menu or activate the highlighted item.
↑↓Open from the trigger or move between enabled items.
HomeEndMove to the first or last enabled item.
A–ZMove to the next item whose text matches the typed characters.
→←Open or close a submenu, adjusted for reading direction.
ShiftF10Open a context-triggered menu from the keyboard.
EscClose the current menu and restore focus to its trigger.

Behavior and Selection

  • Normal Item activates one action and closes by default. Set closeOnSelect only for a deliberate workflow.
  • CheckboxItem and RadioItem stay open by default so users can change more than one option.
  • Use v-model:checked and v-model for controlled option state. Use defaultChecked and defaultValue for uncontrolled state.
  • A menu is not a form field. Use Select, Checkbox, or Radio when a value must be submitted with a form.
  • Use a Dialog for destructive confirmation. A destructive Item communicates risk but does not request confirmation.
  • Keep Root mounted while it is controlled. Use lazyMount and unmountOnExit for cleanup when needed.

Examples

Basic

Use a unique value for each action. Ark UI closes the menu after a normal item is selected.

Icons and Inset Alignment

Use icon for a component icon. Use inset to align text-only rows with icon-bearing rows.

Action Callbacks

Listen to Root select for one action router, or listen to Item select for local behavior.

Checkbox Items

CheckboxItem supports controlled checked and uncontrolled defaultChecked state. It stays open by default for repeated changes.

Radio Group

Use RadioGroup for one choice. v-model is controlled; defaultValue supplies an uncontrolled initial choice.

Nested Submenu

Sub uses right-start positioning by default. Ark UI manages pointer intent, arrow keys, focus return, and nested dismissal.

Custom Trigger

Use as-child so a Kappa Button or another semantic button remains the only focusable trigger element.

LinkItem renders one semantic anchor with menu-item behavior. Disabled links remove href. New-tab links receive noopener noreferrer by default.

Controlled Open State

Bind v-model:open when application state must observe or control visibility.

Destructive and Disabled Items

Destructive changes use the Kappa danger tokens. Disabled items stay visible and are skipped by keyboard navigation.

Long List

Content respects the available viewport height and scrolls without moving the trigger or page.

Context Menu

ContextTrigger opens from a right-click, Shift+F10, or a long press on supported touch and pen input.

Right-to-left

Set dir on Root. Logical spacing, submenu placement, the caret, and arrow keys then follow the reading direction.

Accessibility

  • Give the trigger a visible name or an aria-label. Root ariaLabel labels the menu surface when its context is not clear.
  • Keep Label inside its Group or RadioGroup so Ark UI can associate them.
  • Disabled items use aria-disabled, remain visible, and are skipped by keyboard navigation.
  • Item and LinkItem typeahead falls back to rendered text. CheckboxItem and RadioItem fall back to value. Use valueText for an explicit search label.
  • CheckboxItem and RadioItem expose aria-checked. Do not replace them with a visual selected Item.
  • Shortcut is visual text only. Register application shortcuts separately and document their platform behavior.
  • ContextTrigger supports pointer and keyboard context-menu input. Always keep its target keyboard focusable.
  • ContextTrigger renders type="button" by default. When asChild supplies a custom button, set its type explicitly.
  • Focus indicators remain visible. Open, close, and caret motion stop under reduced-motion preferences.

API Reference

Dropdown.Root

PropTypeDefaultDescription
ariaLabelstring—Accessible menu label when visible context is not sufficient.
dir"ltr" | "rtl"inheritedReading direction for placement and keyboard behavior.
open / defaultOpenbooleanfalseControlled or initial open state.
highlightedValue / defaultHighlightedValuestring—Controlled or initial highlighted item value.
triggerValue / defaultTriggerValuestring—Controlled or initial active trigger in a multi-trigger menu.
positioningPositioningOptionsbottom-start, 6pxArk UI floating position options.
anchorPointPoint—Virtual anchor point for context-positioned content.
closeOnSelectbooleantrueDefault close behavior for normal items.
compositebooleantrueUse menu composite focus and keyboard behavior.
loopFocusbooleanfalseWrap arrow-key focus at the first and last item.
typeaheadbooleantrueEnable printable-character item matching.
navigate(details) => voidnative linkOverride keyboard link navigation for an application router.
id / idsstring / ElementIdsgeneratedStable machine and part IDs for integration or testing.
lazyMount / unmountOnExitbooleanfalseControl presence and cleanup of popup content.

Dropdown.Content

PropTypeDefaultDescription
teleportbooleantrueTeleport Positioner and Content to the target.
teleportToTeleport target"body"Vue Teleport target.
asChildbooleanfalseMerge Content behavior into one child element.

Dropdown.Item and LinkItem

PropTypeDefaultDescription
valuestringrequiredUnique action value used by selection.
valueTextstringrendered textExplicit searchable typeahead text for Item and LinkItem.
variant"default" | "destructive""default"Semantic item treatment.
disabledbooleanfalseExpose but skip an unavailable item.
closeOnSelectbooleanroot valueOverride close behavior for this item.
icon / iconPropsComponent / object—Optional decorative leading icon and its props.
insetbooleanfalseAlign a text-only row with icon-bearing rows.
selectedbooleanfalseShow a trailing visual check. Use RadioItem for a semantic single choice.
asChildbooleanfalseMerge Item behavior into one custom child. Compose custom decoration inside that child.
LinkItem.hrefstringrequiredAnchor destination. It is removed when the link is disabled.
LinkItem.valuestringhrefStable selection value for the link.
LinkItem.target / relstring—Native anchor attributes. target=_blank defaults rel to noopener noreferrer.
SubTrigger.disabledbooleanfalseExpose but skip an unavailable submenu.

Selection Parts

PropTypeDefaultDescription
CheckboxItem / RadioItem.valuestringrequiredUnique option value used by selection and as fallback typeahead text.
CheckboxItem.checked / defaultCheckedbooleanfalseControlled or initial checkbox state.
CheckboxItem.closeOnSelectbooleanfalseKeep the menu open for repeated option changes.
RadioGroup.modelValue / defaultValuestring—Controlled or initial selected radio value.
RadioItem.closeOnSelectbooleanfalseKeep the menu open while a radio choice changes.
CheckboxItem / RadioItem.valueTextstringvalueSearchable typeahead text for an option.
CheckboxItem / RadioItem.disabledbooleanfalseExpose but skip an unavailable option.
CheckboxItem / RadioItem.insetbooleanfalseAdd logical start spacing after the option indicator.
CheckboxItem / RadioItem.asChildbooleanfalseMerge option behavior into one custom child; compose its indicator manually.
RadioGroup.id / asChildstring / booleangenerated / falseGroup identity and custom-element composition.

Parts

PartElementDescription
Dropdown.RootnoneOwns open, highlight, selection, typeahead, and positioning state.
Dropdown.RootProvidernoneProvides an API created with useDropdown.
Dropdown.TriggerbuttonOpens the menu and receives restored focus.
Dropdown.IndicatordivOptional open-state caret for the trigger.
Dropdown.ContentdivPortalled positioner and scroll-safe menu surface.
Dropdown.ItemdivOne action menu item.
Dropdown.LinkItemaSemantic navigation item.
Dropdown.CheckboxItemdivMulti-choice menu item with aria-checked.
Dropdown.RadioGroup / RadioItemdivSingle-choice group and item with aria-checked.
Dropdown.Group / LabeldivAssociated group and visible group label.
Dropdown.SeparatordivSemantic separator between action groups.
Dropdown.ShortcutspanVisual keyboard hint. It does not register a shortcut.
Dropdown.Sub / SubTrigger / SubContentmixedNested menu root, trigger item, and portalled surface.
Dropdown.ContextTriggerbuttonOpens the menu from context-menu input.
Dropdown.ArrowdivOptional positioned arrow and tip.
Dropdown.ItemIndicator / RadioItemIndicatordivComposable checked-state indicator for custom option items.
Dropdown.ItemTextspanComposable item text with overflow handling.
Dropdown.Context / ItemContextnoneScoped slots for Ark menu and item state.

Events

EventPayloadDescription
selectDropdownSelectionDetailsA menu item was selected; details.value identifies it.
openChangeDropdownOpenChangeDetailsThe menu opened or closed.
update:openbooleanVue controlled-state update.
highlightChangeDropdownHighlightChangeDetailsThe roving highlight changed.
update:highlightedValuestring | nullVue controlled highlight update.
triggerValueChange / update:triggerValuedetails / string | nullThe active multi-trigger value changed.
escapeKeyDownKeyboardEventEscape was pressed while the menu was open.
exitCompletevoidThe closing presence transition completed.
focusOutsideDropdownFocusOutsideEventFocus moved outside the open menu.
interactOutsideDropdownInteractOutsideEventPointer or focus interaction occurred outside.
pointerDownOutsideDropdownPointerDownOutsideEventPointer input started outside the open menu.
requestDismissDropdownRequestDismissEventA nested dismissable layer requested dismissal.
checkedChangebooleanCheckboxItem changed its state.
update:checkedbooleanVue controlled checkbox update.
valueChangestringRadioGroup changed its selected value.
update:modelValuestringVue controlled radio-group update.

Exports

ExportDescription
Dropdown / DropdownRootCompound root and named root export.
Dropdown*Named exports for every compound part.
DropdownProps / Dropdown*PropsPublic root and part prop contracts.
DROPDOWN_ITEM_VARIANTSSupported semantic item variants.
DROPDOWN_DEFAULT_ITEM_VARIANTDefault semantic item variant.
DROPDOWN_DEFAULT_POSITIONINGKappa root placement defaults.
DROPDOWN_SUB_DEFAULT_POSITIONINGKappa submenu placement defaults.
isDropdownItemVariant / resolveDropdownItemVariantRuntime item-variant guards and fallback resolver.
useDropdown / useDropdownContextArk UI state-machine hooks under Kappa names.
dropdownAnatomyArk UI menu anatomy under a Kappa name.