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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQAumujy5kXaOKurr6zgTP2krHrFVXi2kj8seRYrlvq2GssUjReh5MiVpQbLFQNy9HsmcasqpBNVsXytWTw0ZDjA=

ActionMenu

import { ActionMenu, MenuBuilder, useMenuBuilder } from '@dxos/react-ui-menu';
Terminal window
npm install @dxos/react-ui-menu @effect/atom-react

ActionMenu draws a list of actions as a dropdown menu, with groups as submenus. Its child is the button that opens it.

An action is a label, an icon and the function it runs. You build the list with MenuBuilder and useMenuBuilder. Because the list is data, other code can add to it. This is how PLEX plugins add items to each other’s menus.

The actions live in an atom.

Wrap your app in RegistryProvider from @effect/atom-react. This is best practice, because your app then controls the registry that the menu reads. Without a provider, the menu reads the library’s default registry.

Add the package’s strings from @dxos/react-ui-menu/translations to the resourceExtensions of Theme.Provider.

Prop Type Effect
...menu MenuActions Sets the actions, from useMenuBuilder
onAction ActionExecutor The user chose an action. onAction runs it in place of the action’s own function
actions MenuItem[] | (() => MenuItem[]) Sets items in place of the group’s own
group MenuGroupContext Sets the group whose items the menu shows. The root’s by default
open boolean Controls whether the menu is open, with onOpenChange
defaultOpen boolean Sets whether the menu starts open, when open is not set
onOpenChange (open: boolean) => void The user opened or closed the menu
deferUntilOpen boolean Builds the menu on the first click, for a menu on every row of a list
virtualRef RefObject<Element | null> Opens the menu at an element other than the trigger
disabled boolean Disables the trigger
container HTMLElement | null Sets the element the menu’s content portals into
children ReactNode Sets the trigger

Spread the actions from useMenuBuilder into ActionMenu, and pass the trigger as its child.

Example (Opening a menu from an icon button)

import {
function useState<S>(initialState: S | (() => S)): [S, React.Dispatch<React.SetStateAction<S>>] (+1 overload)

Returns a stateful value, and a function to update it.

@version ― 16.8.0

@see ― https://react.dev/reference/react/useState

useState
} from 'react';
import {
function ActionMenu(props: ActionMenuProps): React.JSX.Element
ActionMenu
,
const MenuBuilder: Readonly<{
make: () => MenuBuilder;
extend: (groupId: string, cb: ActionGroupBuilderFn) => ActionGraphProps;
}>

Top-level builder that creates the root group and produces the final action graph.

MenuBuilder
,
const useMenuBuilder: (build: (get: AtomContext) => ActionGraphProps, deps: React.DependencyList, options?: MenuActionsOptions) => MenuActions

Convenience wrapper around useMenuActions that creates the backing atom inline. Pass a builder thunk and a dependency list — the hook memoizes Atom.make(build) and threads it through useMenuActions. Saves the useMemo(() => Atom.make(...), deps) boilerplate when the action graph is composed from local state (e.g. a toolbar driven by component state).

Read reactive state via get inside the builder; deps should hold only stable references.

useMenuBuilder
} from '@dxos/react-ui-menu';
import * as
import Button
Button
from '@dxos/react-ui/Button';
import * as
import Typography
Typography
from '@dxos/react-ui/Typography';
/** A dropdown menu built from actions, opened by the button you pass as its child. */
export const
const RowMenu: () => React.JSX.Element

A dropdown menu built from actions, opened by the button you pass as its child.

RowMenu
= () => {
const [
const last: string | undefined
last
,
const setLast: React.Dispatch<React.SetStateAction<string | undefined>>
setLast
] =
useState<string>(): [string | undefined, React.Dispatch<React.SetStateAction<string | undefined>>] (+1 overload)

Returns a stateful value, and a function to update it.

@version ― 16.8.0

@see ― https://react.dev/reference/react/useState

useState
<string>();
const
const menu: MenuActions
menu
=
function useMenuBuilder(build: (get: AtomContext) => ActionGraphProps, deps: React.DependencyList, options?: MenuActionsOptions): MenuActions

Convenience wrapper around useMenuActions that creates the backing atom inline. Pass a builder thunk and a dependency list — the hook memoizes Atom.make(build) and threads it through useMenuActions. Saves the useMemo(() => Atom.make(...), deps) boilerplate when the action graph is composed from local state (e.g. a toolbar driven by component state).

Read reactive state via get inside the builder; deps should hold only stable references.

useMenuBuilder
(
() =>
const MenuBuilder: Readonly<{
make: () => MenuBuilder;
extend: (groupId: string, cb: ActionGroupBuilderFn) => ActionGraphProps;
}>

Top-level builder that creates the root group and produces the final action graph.

MenuBuilder
.
make: () => MenuBuilder
make
()
.
ActionGroupBuilder.action<{
label: string;
icon: string;
}>(id: string, props: {
label: string;
icon: string;
} & MenuItemChrome & {
variant?: "action" | "primary" | "toggle" | "switch" | "custom" | "text";
value?: string;
checked?: boolean;
indent?: number;
render?: (props: CustomRenderProps) => React.ReactNode;
} & {
presentation?: Partial<Record<string, Partial<MenuActionChrome>>>;
}, invoke: () => void): MenuBuilder

Add an action node as a child of the current group.

action
(
'rename',
{
label: string & Label
label
: 'Rename',
icon: string
icon
: 'ph--pencil-simple--regular' },
() =>
const setLast: (value: React.SetStateAction<string | undefined>) => void
setLast
('Rename'),
)
.
ActionGroupBuilder.action<{
label: string;
icon: string;
}>(id: string, props: {
label: string;
icon: string;
} & MenuItemChrome & {
variant?: "action" | "primary" | "toggle" | "switch" | "custom" | "text";
value?: string;
checked?: boolean;
indent?: number;
render?: (props: CustomRenderProps) => React.ReactNode;
} & {
presentation?: Partial<Record<string, Partial<MenuActionChrome>>>;
}, invoke: () => void): MenuBuilder

Add an action node as a child of the current group.

action
(
'duplicate',
{
label: string & Label
label
: 'Duplicate',
icon: string
icon
: 'ph--copy--regular' },
() =>
const setLast: (value: React.SetStateAction<string | undefined>) => void
setLast
('Duplicate'),
)
.
ActionGroupBuilder.separator(variant?: "gap" | "line"): MenuBuilder

Add a separator.

separator
('line')
.
ActionGroupBuilder.action<{
label: string;
icon: string;
}>(id: string, props: {
label: string;
icon: string;
} & MenuItemChrome & {
variant?: "action" | "primary" | "toggle" | "switch" | "custom" | "text";
value?: string;
checked?: boolean;
indent?: number;
render?: (props: CustomRenderProps) => React.ReactNode;
} & {
presentation?: Partial<Record<string, Partial<MenuActionChrome>>>;
}, invoke: () => void): MenuBuilder

Add an action node as a child of the current group.

action
('delete', {
label: string & Label
label
: 'Delete',
icon: string
icon
: 'ph--trash--regular' }, () =>
const setLast: (value: React.SetStateAction<string | undefined>) => void
setLast
('Delete'),
)
.
MenuBuilder.build(): ActionGraphProps

Return the assembled action graph.

build
(),
[],
);
return (
<>
<
function ActionMenu(props: ActionMenuProps): React.JSX.Element
ActionMenu
{...
const menu: MenuActions
menu
}>
<
import Button
Button
.
const Root: React.ForwardRefExoticComponent<Omit<Button.RootProps, "className"> & {
classNames?: ClassNameValue;
} & Pick<React.HTMLAttributes<Element>, "children" | "style" | "role"> & React.RefAttributes<HTMLButtonElement>>
export Root
Root
icon?: string | undefined

Leading icon.

icon
='ph--dots-three-vertical--regular'
label?: string | undefined

Visible text; children take precedence.

Required: names the button (aria-label) and shows in a Tooltip.

label
='Options'
iconOnly?: boolean | undefined

A control-sized square inset in a block-sized cell (follow-up 19), showing only the icon.

iconOnly
/>
</
function ActionMenu(props: ActionMenuProps): React.JSX.Element
ActionMenu
>
<
import Typography
Typography
.
const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
asChild?: boolean;
}, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & Pick<React.HTMLAttributes<Element>, "children" | "style" | "role"> & React.RefAttributes<HTMLParagraphElement>>
export Text

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
tone?: Typography.TextTone | undefined

Emphasis below the default (DESIGN.md "Text emphasis"): description for secondary content, subdued for interface text.

tone
='muted'>
{
const last: string | undefined
last
? `Ran ${
const last: string
last
}` : 'Nothing run yet'}
</
import Typography
Typography
.
const Text: React.ForwardRefExoticComponent<Omit<Typography.TextProps & {
asChild?: boolean;
}, "className"> & {
classNames?: import("@dxos/ui-types").ClassNameValue;
} & Pick<React.HTMLAttributes<Element>, "children" | "style" | "role"> & React.RefAttributes<HTMLParagraphElement>>
export Text

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
>
</>
);
};

MenuBuilder makes three actions, with a separator before Delete. The icon-only Button.Root is the trigger, and each action’s function records its name in state.