A menu is a list of items that opens from a trigger or, as a context menu, from a right click. The arrow keys move
between items, Enter chooses one, and Escape closes the menu.
1
import {
functionuseState<S>(initialState: S | (() =>S)): [S, React.Dispatch<React.SetStateAction<S>>] (+1overload)
Returns a stateful value, and a function to update it.
One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.
gap is restricted to the named steps of the theme spacing ramp (see
Gap
), which is the
point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents.
Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the
component deliberately grows no padding or colour props, since components own their own spacing.
There is no implicit align. Row-centering is the common case, but defaulting it would silently
restyle any consumer relying on the CSS stretch initial value.
Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).
@example
<Flex column gap='sm'>…</Flex>
<Flex gap='sm' justify='end'>…</Flex>
<Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>
Portalled menu at level='popup', scrolling in a thin ScrollArea whose viewport is the menu itself; a nested menu's
Content is the same part inside a Menu.Sub.
Portalled menu at level='popup', scrolling in a thin ScrollArea whose viewport is the menu itself; a nested menu's
Content is the same part inside a Menu.Sub.
Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines
it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.
Text whose first line is centred in a block, so it lines up with a Block or control beside it however many lines
it wraps to. Renders a <p>; asChild puts the metrics on a heading or other text element instead.
One-axis layout box: the primitive that replaces hand-written flex … wrapper divs.
gap is restricted to the named steps of the theme spacing ramp (see
Gap
), which is the
point of the prop — an off-ramp gap-2/gap-3 literal in a container is the drift it prevents.
Anything the props don't cover (padding, sizing, overflow, colour) goes through classNames; the
component deliberately grows no padding or colour props, since components own their own spacing.
There is no implicit align. Row-centering is the common case, but defaulting it would silently
restyle any consumer relying on the CSS stretch initial value.
Use asChild to project the layout onto a semantic element (<header>, <ul>, <a>).
@example
<Flex column gap='sm'>…</Flex>
<Flex gap='sm' justify='end'>…</Flex>
<Flex center classNames='h-full text-fg-subtle' role='status'>{t('empty.message')}</Flex>
An item given only item renders its icon, label and shortcut. Give it children to arrange the parts yourself.
shortcut is display text only. It binds no key.
@dxos/react-ui-menu builds menus and toolbars from an app’s actions, so that plugins can add items to each other’s
menus. See ActionMenu and
ActionToolbar.