@antadesign/anta
    Preparing search index...

    Interface MenuPropsUnreviewed

    Common props for JSX component wrappers.

    interface MenuProps {
        placement?:
            | "bottom-start"
            | "bottom-end"
            | "top-start"
            | "top-end"
            | "bottom"
            | "top"
            | "right-start"
            | "right-end"
            | "left-start"
            | "left-end"
            | "right"
            | "left";
        context?: boolean;
        coord?: boolean;
        nohover?: boolean;
        offset?: number;
        autoWidth?: boolean;
        inset?: number
        | string;
        open?: boolean;
        round?: boolean | number | string;
        stopPropagation?: boolean | string | string[];
        onStateChange?: (
            event: CustomEvent,
            detail: { next: boolean; prev: boolean },
        ) => void;
        onactivedescendant?: (e: CustomEvent<{ id: string | null }>) => void;
        role?: string;
        children?: ReactNode;
        className?: string;
        style?: CSSProperties;
        id?: string;
        title?: string;
        slot?: string;
        tabIndex?: number;
        key?: string | number | null;
        [key: `data-${string}`]: unknown;
        [key: `aria-${string}`]: unknown;
    }

    Hierarchy (View Summary)

    Indexable

    • [key: `data-${string}`]: unknown

      Any data-* attribute is forwarded to the rendered element.

    • [key: `aria-${string}`]: unknown

      Any aria-* attribute is forwarded to the rendered element.

    Index
    placement?:
        | "bottom-start"
        | "bottom-end"
        | "top-start"
        | "top-end"
        | "bottom"
        | "top"
        | "right-start"
        | "right-end"
        | "left-start"
        | "left-end"
        | "right"
        | "left"

    Preferred placement relative to the trigger. bottom / top place the menu below / above; right / left place it beside (like a submenu flyout). The cross-axis suffix (-start / -end) aligns the near / far edges, and no suffix centers on the trigger. The menu flips to the opposite side when the preferred one lacks room, and clamps to the viewport.

    bottom-start
    
    context?: boolean

    Open on right-click (the contextmenu event) of the trigger region instead of a left click, positioned at the pointer.

    coord?: boolean

    Open at the pointer coordinates rather than aligned to the trigger box. Pairs naturally with context; on its own it positions a left-click menu at the cursor.

    nohover?: boolean

    Submenu-only (a <Menu> nested inside a MenuItem); ignored on a root menu. Submenus open on hover by default (with intent timing) as well as on click — set nohover to make this submenu click-only. Hover-intent is mouse-only regardless: on touch (and pen) a submenu always opens on tap and stays open until dismissed.

    offset?: number

    Gap in pixels between the trigger and the menu.

    4
    
    autoWidth?: boolean

    Size the menu to its content instead of flooring its width to the trigger. A root menu is never narrower than its trigger by default; set this for a content menu under a wide trigger (e.g. a calendar below a full-width field) so it wraps its content and left-aligns under the trigger.

    inset?: number | string

    Inner inset for the scroll body and named header/footer content. A number is pixels; a CSS length string is used as written.

    4
    
    open?: boolean

    Controlled open state. Omit for the default uncontrolled menu (it opens/closes itself via its triggers). Pass a boolean to control it: the menu's visibility follows open, and user dismiss (Esc, outside-click, select) fires onStateChange without self-closing — you update open in response. Submenus are always uncontrolled regardless of this. See STATEFUL-COMPONENTS.md.

    round?: boolean | number | string

    Round the menu: the container softens to a 20px radius and its items go fully round. A number (px) or CSS length string tunes the container radius only — items stay full pills.

    stopPropagation?: boolean | string | string[]

    Contain events so they don't bubble out of the menu to ancestor handlers (e.g. a clickable row the menu sits in). Selecting an item is always contained; this extends it to whole event types. true contains click; pass an event name or list ("click pointerdown") to contain those.

    onStateChange?: (
        event: CustomEvent,
        detail: { next: boolean; prev: boolean },
    ) => void

    Fired before the open state changes — on open, and on every dismiss (Esc, outside-click, scroll, selecting an item). event is the cancelable statechange; detail.next/detail.prev are the requested/previous open state (booleans). It's the declarative way to observe a menu, and the handler you pair with open to drive a controlled menu (apply detail.next to open). Uncontrolled, event.preventDefault() vetoes the transition (e.g. keep the menu open).

    onactivedescendant?: (e: CustomEvent<{ id: string | null }>) => void

    Combobox-mode cursor report (raw element event). Fires when the active option changes as arrow keys move the cursor while focus stays in a [data-menu-search] filter field; detail.id is an authored option id, or null. Built-in Anta Inputs receive the active option through a direct ARIA element relationship; this remains available to custom fields and observers. Passed straight through to the element.

    role?: string

    ARIA role of the menu surface.

    menu
    
    children?: ReactNode

    The menu's contents: MenuItem, MenuSeparator, MenuGroup, or any custom element.

    className?: string

    CSS class on the component's root element (merged with the component's own classes). Use it directly for layout and positioning — grid/flex placement, margins, alignment — rather than wrapping the component in a <div>/<span>.

    style?: CSSProperties

    Inline styles on the component's root element. Set layout/positioning here (or via className) directly on the component instead of adding a wrapper.

    id?: string

    HTML id attribute.

    title?: string

    HTML title attribute — native browser tooltip on hover.

    slot?: string

    Assigns the element to a named <slot> of a parent web component (e.g. slot="header" inside a <Card>, slot="footer" inside a <Dialog>).

    tabIndex?: number

    Tab order. Set to -1 to skip the element when tabbing.

    key?: string | number | null

    React/Preact reconciliation key when rendered inside a list. Consumed by the JSX runtime (not forwarded as a DOM attribute).