Menu presents a set of actions to perform on the currently visible or selected resource.
There are use cases when a "More" or "Actions" menu is needed to show contextual actions relevant to the currently visible resource. Usually these menus don't actually say "More" or "Actions", but show an icon with three dots in it.
Hightouch UI offers a convenience component specifically for that use case called MenuActionsButton
to replace MenuButton
with.
If you need to use a custom icon, use MenuIconButton
component.
Use this variant to achieve a border around the menu button.
Use this variant for badge menus.
The menu button (including actions and icon button) can be disabled.
You can also disable individual menu items, instead of disabling the entire button.
The menu opens and closes automatically when the toggle button is clicked. However, the state may be controlled with the isOpen
state.
The menu position may be specified using the placement
prop. The default is usually the correct option, but in the Journeys canvas the menu may have a centered state.
The menu renders the popover invisibly on mount. To prevent widening the window unintentionally, the menu computes its position on mount. This may be turned off by using computePositionOnMount
.
Name | Default | Description |
---|---|---|
computePositionOnMount | true | boolean Compute the position of the menu on mount. |
children | — | ReactNode Menu button and list. |
closeOnSelect | true | boolean Close the menu when an item is selected. |
isOpen | undefined | boolean Controls the menu's open state. If the value is undefined, the menu will be uncontrolled. |
onOpen | — | () => void Callback fired when the menu opens. Only for controlled menus. |
onClose | — | () => void Callback fired when the menu closes. Only for controlled menus. |
placement | "default" | "default" | "center" Placement of the menu. |
Name | Default | Description |
---|---|---|
variant | "secondary" | "primary" | "secondary" | "tertiary" The button variant. |
size | "md" | "sm" | "md" | "lg" Determines the height of the button. |
Name | Default | Description |
---|---|---|
aria-label | "Actions" | string Button text for screen readers. |
Name | Default | Description |
---|---|---|
variant | "tertiary" | "secondary" | "tertiary" Button variant, which determines its appearance. |
onClick | — | (event: MouseEvent<HTMLButtonElement>) => void Click event handler. |
Name | Default | Description |
---|---|---|
children | — | ReactNode Menu items. |
Name | Default | Description |
---|---|---|
isDisabled | — | boolean Determines if menu item is disabled. |
children | — | ReactNode Menu item text. |
icon | — | ComponentType<SVGAttributes<SVGElement>> Icon. |
variant | — | "normal" | "danger" Variant. Use `"danger"` for destructive or dangerous actions. |
onClick | — | (event: MouseEvent<HTMLButtonElement>) => void Callback for when user clicks a menu item. |
Name | Default | Description |
---|