Menu

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.

#

Primary
Secondary
Tertiary
Warning
Danger
Menu button
Menu icon button

#

#

  • When user needs to perform some actions on one or more selected items on the current page.
  • As a replacement for button group, when there are too many buttons inside.

#

  • If menu is used for in-page navigation or replacing part of the page content, use tabs instead.

#

  • Use sentence case.
  • Position dangerous menu items last and add a divider before them.

#

  • Only use icons from Hightouch UI.
  • Don't override icon size.
  • Menus look much better with icons, so try to find an icon that matches each menu item.
  • If menu items are too similar in their meaning and would require repeating the same icon, skip icons altogether.

#

NameDefaultDescription
computePositionOnMounttrueboolean

Compute the position of the menu on mount.

children

ReactNode

Menu button and list.

closeOnSelecttrueboolean

Close the menu when an item is selected.

isOpenundefinedboolean

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.

NameDefaultDescription
variant"secondary""primary" | "secondary" | "tertiary"

The button variant.

size"md""sm" | "md" | "lg"

Determines the height of the button.

NameDefaultDescription
aria-label"Actions"string

Button text for screen readers.

NameDefaultDescription
variant"tertiary""secondary" | "tertiary"

Button variant, which determines its appearance.

onClick

(event: MouseEvent<HTMLButtonElement>) => void

Click event handler.

NameDefaultDescription
children

ReactNode

Menu items.

NameDefaultDescription
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.

NameDefaultDescription

On this page