You can also pass an array of arrays to the items prop to create separated groups of items.
Each item can take a children array of objects with the same properties as the items prop to create a nested menu which can be controlled using the open, defaultOpen and content properties.
Use the extractShortcuts utility to automatically define shortcuts from menu items with a kbds property. It recursively extracts shortcuts and returns an object compatible with defineShortcuts.
Flip to the opposite side when colliding with boundary. Defaults to true.
alignOffset?: number
An offset in pixels from the start or end alignment options. Defaults to 0.
alignFlip?: boolean
Flip alignment when colliding with boundary.
May only occur when prioritizePosition is true. Defaults to true.
avoidCollisions?: boolean
When true, overrides the side and align preferences
to prevent collisions with boundary edges. Defaults to true.
collisionBoundary?: Element | (Element | null)[] | null
The element used as the collision boundary. By default
this is the viewport, though you can provide additional
element(s) to be included in this check. Defaults to [].
The distance in pixels from the boundary edges where collision
detection should occur. Accepts a number (same for all sides),
or a partial padding object, for example: { top: 20, left: 20 }. Defaults to 0.
hideShiftedArrow?: boolean
When true, hides the arrow when it cannot be centered
to the reference element. Defaults to true.
sticky?: "partial" | "always"
The sticky behavior on the align axis. partial will keep the
content in the boundary as long as the trigger is at least partially
in the boundary whilst "always" will keep the content in the boundary
regardless. Defaults to "partial".
hideWhenDetached?: boolean
Whether to hide the content when the trigger becomes fully occluded. Defaults to false.
positionStrategy?: "fixed" | "absolute"
The type of CSS position property to use.
disableUpdateOnLayoutShift?: boolean
Whether to disable the update position for the content when the layout shifted. Defaults to false.
prioritizePosition?: boolean
Force content to be position within the viewport.
Might overlap the reference element, which may not be desired. Defaults to false.
reference?: ReferenceElement
The custom element or virtual element that will be set as the reference
to position the floating element.
If provided, it will replace the default anchor element.
loop?: boolean
When true, keyboard navigation will loop from last item to first, and vice versa. Defaults to false.
Matches a string with a regular expression, and returns an array containing the results of that search.
Matches a string or an object that supports being matched against, and returns an array
containing the results of that search, or null if no matches are found.
Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale.
trim: () => string
Removes the leading and trailing white space and line terminator characters from a string.
length: number
Returns the length of a String object.
substr: (from: number, length?: number | undefined) => string
Gets a substring beginning at the specified location and having the specified length.
codePointAt: (pos: number) => number
Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
value of the UTF-16 encoded code point starting at the string element at position pos in
the String resulting from converting this object to a String.
If there is no element at that position, the result is undefined.
If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
includes: (searchString: string, position?: number | undefined) => boolean
Returns true if searchString appears as a substring of the result of converting this
object to a String, at one or more positions that are
greater than or equal to position; otherwise, returns false.
endsWith: (searchString: string, endPosition?: number | undefined) => boolean
Returns true if the sequence of elements of searchString converted to a String is the
same as the corresponding elements of this object (converted to a String) starting at
endPosition – length(this). Otherwise returns false.
Returns the String value result of normalizing the string into the normalization form
named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
repeat: (count: number) => string
Returns a String value that is made from count copies appended together. If count is 0,
the empty string is returned.
startsWith: (searchString: string, position?: number | undefined) => boolean
Returns true if the sequence of elements of searchString converted to a String is the
same as the corresponding elements of this object (converted to a String) starting at
position. Otherwise returns false.
anchor: (name: string) => string
Returns an <a> HTML anchor element and sets the name attribute to the text value
big: () => string
Returns a <big> HTML element
blink: () => string
Returns a <blink> HTML element
bold: () => string
Returns a <b> HTML element
fixed: () => string
Returns a <tt> HTML element
fontcolor: (color: string) => string
Returns a <font> HTML element and sets the color attribute value
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
The padding is applied from the start (left) of the current string.
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
The padding is applied from the end (right) of the current string.
trimEnd: () => string
Removes the trailing white space and line terminator characters from a string.
trimStart: () => string
Removes the leading white space and line terminator characters from a string.
trimLeft: () => string
Removes the leading white space and line terminator characters from a string.
trimRight: () => string
Removes the trailing white space and line terminator characters from a string.
Matches a string with a regular expression, and returns an array containing the results of that search.
Matches a string or an object that supports being matched against, and returns an array
containing the results of that search, or null if no matches are found.
Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale.
trim: () => string
Removes the leading and trailing white space and line terminator characters from a string.
length: number
Returns the length of a String object.
substr: (from: number, length?: number | undefined) => string
Gets a substring beginning at the specified location and having the specified length.
codePointAt: (pos: number) => number
Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
value of the UTF-16 encoded code point starting at the string element at position pos in
the String resulting from converting this object to a String.
If there is no element at that position, the result is undefined.
If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
includes: (searchString: string, position?: number | undefined) => boolean
Returns true if searchString appears as a substring of the result of converting this
object to a String, at one or more positions that are
greater than or equal to position; otherwise, returns false.
endsWith: (searchString: string, endPosition?: number | undefined) => boolean
Returns true if the sequence of elements of searchString converted to a String is the
same as the corresponding elements of this object (converted to a String) starting at
endPosition – length(this). Otherwise returns false.
Returns the String value result of normalizing the string into the normalization form
named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
repeat: (count: number) => string
Returns a String value that is made from count copies appended together. If count is 0,
the empty string is returned.
startsWith: (searchString: string, position?: number | undefined) => boolean
Returns true if the sequence of elements of searchString converted to a String is the
same as the corresponding elements of this object (converted to a String) starting at
position. Otherwise returns false.
anchor: (name: string) => string
Returns an <a> HTML anchor element and sets the name attribute to the text value
big: () => string
Returns a <big> HTML element
blink: () => string
Returns a <blink> HTML element
bold: () => string
Returns a <b> HTML element
fixed: () => string
Returns a <tt> HTML element
fontcolor: (color: string) => string
Returns a <font> HTML element and sets the color attribute value
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
The padding is applied from the start (left) of the current string.
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
The padding is applied from the end (right) of the current string.
trimEnd: () => string
Removes the trailing white space and line terminator characters from a string.
trimStart: () => string
Removes the leading white space and line terminator characters from a string.
trimLeft: () => string
Removes the leading white space and line terminator characters from a string.
trimRight: () => string
Removes the trailing white space and line terminator characters from a string.