Menu
A list of options to help users navigate, or perform actions.Caution
We're planning to deprecate Menu. Do not use it. Use Navigation system for side navigation, or Dropdown menu for contextual actions and options.
Neutral selected states
When the platform-dst-tokens-finesse feature flag is enabled, this component uses the new neutral treatment for selected states.
Installation
| Install | yarn add @atlaskit/menu |
|---|---|
| Source | Bitbucket.org, (opens new window) |
| npm | @atlaskit/menu, (opens new window) |
| Bundle | unpkg.com, (opens new window) |
Props
| Description | Children of the menu group.
This should generally be |
|---|---|
| Type | string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
| Description | Used this to tell assistive technologies that the menu group is loading. |
|---|---|
| Type | boolean |
| Description | Use this to constrain the menu group's height to a specific value. This must be set if you want to have scrollable sections. |
|---|---|
| Type | string | number |
| Description | Use this to constrain the menu group's maximum width to a specific value. |
|---|---|
| Type | string | number |
| Description | Use this to constrain the menu group's minimum height to a specific value. |
|---|---|
| Type | string | number |
| Description | Use this to constrain the menu group's minimum width to a specific value. |
|---|---|
| Type | string | number |
| Description | Handler called when clicking on this element, or any children elements. Useful when needing to stop propagation of child events. |
|---|---|
| Type | (event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => void |
| Description | Use this to override the accessibility role for the element. |
|---|---|
| Type | string |
| Description | Configure the density of the menu group content. |
|---|---|
| Default | "cozy" |
| Type | "compact" | "cozy" |
| Description | A |
|---|---|
| Type | string |
Section props
| Description | Children of the section.
This should generally be |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | Use this to render a border at the top of the section. |
|---|---|
| Type | boolean |
| Description | Unique identifier for the element. |
|---|---|
| Type | string |
| Description | If your menu contains a list, use this to add |
|---|---|
| Type | boolean |
| Description | Enables scrolling within the section.
This won't work unless |
|---|---|
| Type | boolean |
| Description | Provide an accessible label for the section via |
|---|---|
| Type | string |
| Description | Allows getting a ref to the component instance.
Once the component unmounts, React will set @see {@link https://react.dev/learn/referencing-values-with-refs#refs-and-the-dom React Docs} |
|---|---|
| Type | string | Ref<HTMLElement> |
| Description | A |
|---|---|
| Type | string |
| Description | The text passed into the internal |
|---|---|
| Type | string |
| Description | ID referenced by the menu group wrapper's |
|---|---|
| Type | string |
Heading item props
| Description | The text of the heading. |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | Specifies the heading level in the document structure.
If not specified, the default is |
|---|---|
| Type | 1 | 2 | 3 | 4 | 5 | 6 |
| Description | A unique identifier that can be referenced in the |
|---|---|
| Type | string |
| Description | A |
|---|---|
| Type | string |
| Description | Primary content for the item. |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | This prop must not be used and will be deleted soon. Style overrides are not supported.
If you need a custom list item, do not use |
|---|---|
| Type | string |
| Description | Description of the item. This will render smaller text below the primary text of the item, and slightly increase the height of the item. |
|---|---|
| Type | string | global.JSX.Element |
| Description | Element to render after the item text. Usually this is an icon component. |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | Element to render before the item text. Usually this is an icon component. |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | Unique identifier for the element. |
|---|---|
| Type | string |
| Description | An optional name used to identify events for React UFO (Unified Frontend Observability) press interactions. For more information, see React UFO integration into Design System components. |
|---|---|
| Type | string |
| Description | Makes the element appear disabled as well as removing interactivity. Avoid disabling menu items wherever possible as this isn’t accessible or usable. |
|---|---|
| Type | boolean |
| Description | Makes the element appear selected. |
|---|---|
| Type | boolean |
| Description | When |
|---|---|
| Type | boolean |
| Description | Event that's triggered when the element is clicked. |
|---|---|
| Type | (e: MouseEvent<HTMLElement, globalThis.MouseEvent> | KeyboardEvent<HTMLElement>) => void |
| Description | Event that's triggered when the element has been pressed. |
|---|---|
| Type | (event: MouseEvent<Element, globalThis.MouseEvent>) => void |
| Description | No description. |
|---|---|
| Type | ((instance: HTMLElement) => void) | RefObject<HTMLElement> |
| Description | Use this to override the accessibility role for the element. |
|---|---|
| Type | string |
| Description | When |
|---|---|
| Type | boolean |
| Description | When |
|---|---|
| Type | boolean |
| Description | A |
|---|---|
| Type | string |
Link item props
| Description | Primary content for the item. |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | This prop must not be used and will be deleted soon. Style overrides are not supported.
If you need a custom list item, do not use |
|---|---|
| Type | string |
| Description | Description of the item. This will render smaller text below the primary text of the item, and slightly increase the height of the item. |
|---|---|
| Type | string | global.JSX.Element |
| Description | Link to another page. |
|---|---|
| Type | string |
| Description | Element to render after the item text. Usually this is an icon component. |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | Element to render before the item text. Usually this is an icon component. |
|---|---|
| Type | string | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal |
| Description | An optional name used to identify events for React UFO (Unified Frontend Observability) press interactions. For more information, see React UFO integration into Design System components. |
|---|---|
| Type | string |
| Description | Makes the element appear disabled as well as removing interactivity. Avoid disabling menu items wherever possible as this isn’t accessible or usable. |
|---|---|
| Type | boolean |
| Description | Makes the element appear selected. |
|---|---|
| Type | boolean |
| Description | When |
|---|---|
| Type | boolean |
| Description | Event that's triggered when the element is clicked. |
|---|---|
| Type | (e: MouseEvent<HTMLElement, globalThis.MouseEvent> | KeyboardEvent<HTMLElement>) => void |
| Description | Event that's triggered when the element has been pressed. |
|---|---|
| Type | (event: MouseEvent<Element, globalThis.MouseEvent>) => void |
| Description | No description. |
|---|---|
| Type | ((instance: HTMLElement) => void) | RefObject<HTMLElement> |
| Description | The relationship of the linked URL as space-separated link types.
Generally you'll want to set this to "noopener noreferrer" when |
|---|---|
| Type | string |
| Description | Use this to override the accessibility role for the element. |
|---|---|
| Type | string |
| Description | When |
|---|---|
| Type | boolean |
| Description | When |
|---|---|
| Type | boolean |
| Description | Where to display the linked URL, see anchor information on mdn for more information. |
|---|---|
| Type | string |
| Description | A |
|---|---|
| Type | string |
| Description | Use this to prevent disable of drag functionality on the menu item. Marked as "unsafe" as this may break existing instances of drag handling. |
|---|---|
| Type | boolean |
| Description | Use this to opt out of using a router link and instead use a regular anchor element. Marked as "unsafe" because ideally, router links should be used for all internal links. |
|---|---|
| Type | boolean |
Custom item props
| Description | Primary content for the item. |
|---|---|
| Type | string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
| Description | This prop must not be used and will be deleted soon. Style overrides are not supported.
If you need a custom list item, do not use |
|---|---|
| Type | string |
| Description | Custom component to render as an item. This can be both a functional component or a class component. Will return Props passed to E.g. NOTE: Make sure the reference for this component does not change between renders else undefined behavior may happen. |
|---|---|
| Type | React.ComponentClass<React.PropsWithChildren<TComponentProps>, any> | React.FunctionComponent<React.PropsWithChildren<TComponentProps>> |
| Description | Description of the item. This will render smaller text below the primary text of the item, and slightly increase the height of the item. |
|---|---|
| Type | string | JSX.Element |
| Description | Element to render after the item text. Usually this is an icon component. |
|---|---|
| Type | string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
| Description | Element to render before the item text. Usually this is an icon component. |
|---|---|
| Type | string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
| Description | An optional name used to identify events for React UFO (Unified Frontend Observability) press interactions. For more information, see React UFO integration into Design System components. |
|---|---|
| Type | string |
| Description | Makes the element appear disabled as well as removing interactivity. Avoid disabling menu items wherever possible as this isn’t accessible or usable. |
|---|---|
| Type | boolean |
| Description | Makes the element appear selected. |
|---|---|
| Type | boolean |
| Description | When |
|---|---|
| Type | boolean |
| Description | Event that's triggered when the element is clicked. |
|---|---|
| Type | (e: React.MouseEvent<HTMLElement, MouseEvent> | React.KeyboardEvent<HTMLElement>) => void |
| Description | Event that's triggered when the element has been pressed. |
|---|---|
| Type | (event: React.MouseEvent<Element, MouseEvent>) => void |
| Description | No description. |
|---|---|
| Type | any |
| Description | When |
|---|---|
| Type | boolean |
| Description | When |
|---|---|
| Type | boolean |
| Description | A |
|---|---|
| Type | string |
| Description | Use this to prevent disable of drag functionality on the menu item. Marked as "unsafe" as this may break existing instances of drag handling. |
|---|---|
| Type | boolean |
Skeleton heading item props
| Description | Causes to the skeleton to have a slight horizontal shimmer. Only use this when you want to bring more attention to the loading content. |
|---|---|
| Default | false |
| Type | boolean |
| Description | A |
|---|---|
| Type | string |
| Description | Width of the skeleton heading item.
You usually don't need to specify this, as it has a staggered width based on |
|---|---|
| Type | string | number |
| Description | Bounded style overrides. |
|---|---|
| Type | false | (XCSSValue<"paddingBlockEnd" | "paddingBlockStart" | "paddingInlineEnd" | "paddingInlineStart" | "paddingBlock" | "paddingInline", DesignTokenStyles, ""> & ... 4 more ... & { ...; }) |
Skeleton item props
| Description | Renders a skeleton circle in the |
|---|---|
| Type | boolean |
| Description | Renders a skeleton square in the |
|---|---|
| Type | boolean |
| Description | Causes to the skeleton to have a slight horizontal shimmer. Only use this when you want to bring more attention to the loading content. |
|---|---|
| Default | false |
| Type | boolean |
| Description | A |
|---|---|
| Type | string |
| Description | Width of the skeleton item.
You usually don't need to specify this, as it has a staggered width based on |
|---|---|
| Type | string | number |
| Description | Bounded style overrides. |
|---|---|
| Type | false | (XCSSValue<"minHeight" | "paddingBlockEnd" | "paddingBlockStart" | "paddingInlineEnd" | "paddingInlineStart" | "paddingBlock" | "paddingInline", DesignTokenStyles, ""> & ... 4 more ... & { ...; }) |
| Description | Children of the menu group.
This should generally be |
|---|---|
| Type | string | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal |
| Description | Used this to tell assistive technologies that the menu group is loading. |
|---|---|
| Type | boolean |
| Description | Use this to constrain the menu group's height to a specific value. This must be set if you want to have scrollable sections. |
|---|---|
| Type | string | number |
| Description | Use this to constrain the menu group's maximum width to a specific value. |
|---|---|
| Default | 800 |
| Type | string | number |
| Description | Use this to constrain the menu group's minimum height to a specific value. |
|---|---|
| Type | string | number |
| Description | Use this to constrain the menu group's minimum width to a specific value. |
|---|---|
| Default | 320 |
| Type | string | number |
| Description | Handler called when clicking on this element, or any children elements. Useful when needing to stop propagation of child events. |
|---|---|
| Type | (event: React.MouseEvent<Element, MouseEvent> | React.KeyboardEvent<Element>) => void |
| Description | Use this to override the accessibility role for the element. |
|---|---|
| Type | string |
| Description | Configure the density of the menu group content. |
|---|---|
| Type | "compact" | "cozy" |
| Description | A |
|---|---|
| Type | string |