Overlays

DropdownItem

Selectable menuitem inside a dropdown-menu that handles activation, keyboard support, and optional close-on-select behavior.

import { DropdownItem } from '@lostgradient/cinder';
overlaymenu
01

Overview

Selectable item within a dropdown menu, supporting icons, labels, and keyboard navigation.

Usage

DropdownItem is a compose-only leaf of Dropdown. The idiomatic API is Dropdown.Item, reached through the parent namespace — see the dropdown README for the composed snippet. The leaf is also a named export of @lostgradient/cinder.

A disabled item that cannot say why on its own takes disabledReason: the item draws the reason as a second line under its label, in the disabled colour at the extra-small size, so it never reads louder than the label, starting where the label's text starts, past a leading icon, and names it as its description (aria-describedby), while its name stays the label. It is drawn at every width, so a phone reads it without a hover, which a title never gives. An enabled item ignores it.

02

When to use

Use when
  • Rendering an individual action or link row inside a dropdown-menu.
  • Composing menu rows that should close the parent dropdown after selection unless closeOnSelect is disabled.
Avoid when
  • Used outside a dropdown context — it requires the dropdown provider and will throw otherwise.
  • Grouping a static heading row above menu items — use dropdown-label.
03

Props

Props for dropdown-item
Name
Type
Default
Description
variant 'default' | 'danger' 'default' Visual style of the item. Use danger to signal a destructive action. Default default.
itemRole 'menuitem' | 'menuitemcheckbox' | 'menuitemradio' 'menuitem' ARIA role for the row. Use menuitemcheckbox or menuitemradio for selectable menu items.
checked boolean false Checked state for checkbox and radio menu items. A checked menuitemradio or menuitemcheckbox item draws a leading check mark, and every such item reserves its space, so the labels of a group start at one edge. The mark is hidden from assistive technology; aria-checked carries the state. Omitted for normal menu items.
inset boolean false When true, adds leading padding to align the item with items that have a leading icon or indicator. Default false.
disabled boolean When true the item is inert: click is blocked and aria-disabled is set.
disabledReason text Why the item is off. While disabled is set it is drawn under the label as a second line in the disabled colour at the extra-small size, never louder than the label, and it is the item's description (aria-describedby), so it reads on a phone and by keyboard with no hover. Ignored while the item is enabled. Use it in place of a title, which touch never shows.
closeOnSelect boolean true When true, the parent dropdown closes after this item is activated. Default true.
onclick MouseEventHandler<T> | undefined | null
onkeydown KeyboardEventHandler<T>undefinednull
href discriminated-union Destination URL. Any defined value — including an empty string — selects the anchor branch and renders an <a>. Omit href entirely to render a <button>.
children snippet