<Menu
trigger={(props) => <CustomButton {...props}>Custom Trigger</CustomButton>}
open={false}
disableAutoHeight={false}
>
<Menu.Item label="Item 1" />
<Menu.Item label="Item 2" />
</Menu>
When using the trigger prop to render a custom trigger, the following props are available:This will stop the menu from automatically deciding which way to open based on
the trigger’s location on the screen.
trigger
(TriggerReturnProps) => ReactElement
<Menu
trigger={(props) => (
<button
{...props}
aria-controls={props["aria-controls"]}
aria-expanded={props["aria-expanded"]}
aria-haspopup={props["aria-haspopup"]}
onClick={props.onClick}
>
Custom Trigger
</button>
)}
>
<Menu.Item label="Item 1" />
</Menu>
TriggerReturnProps
The following props are passed as an object parameter in the custom trigger callback function when using the trigger prop. The function should return a ReactElement which should have the TriggerReturnProps passed to (see Creating custom menu triggers).Identifies the element (or elements) whose contents or presence are controlled
by the current element.
Indicates whether the element, or another grouping element it controls, is
currently expanded or collapsed.
Indicates the availability and type of interactive popup element, such as menu
or dialog, that can be triggered by an element.