UNPKG

@base-ui-components/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

53 lines (52 loc) 1.7 kB
import * as React from 'react'; import { FloatingEvents } from '@floating-ui/react'; import { GenericHTMLProps } from '../../utils/types.js'; export declare function useMenuItem(params: useMenuItem.Parameters): useMenuItem.ReturnValue; export declare namespace useMenuItem { interface Parameters { /** * Whether to close the menu when the item is clicked. */ closeOnClick: boolean; /** * Whether the component should ignore user interaction. */ disabled: boolean; /** * Determines if the menu item is highlighted. */ highlighted: boolean; /** * The id of the menu item. */ id: string | undefined; /** * The FloatingEvents instance of the menu's root. */ menuEvents: FloatingEvents; /** * The ref of the trigger element. */ ref?: React.Ref<Element>; /** * Whether to treat mouseup events as clicks. */ allowMouseUpTriggerRef: React.RefObject<boolean>; /** * A ref that is set to `true` when the user is using the typeahead feature. */ typingRef: React.RefObject<boolean>; } interface ReturnValue { /** * Resolver for the root slot's props. * @param externalProps event handlers for the root slot * @returns props that should be spread on the root slot */ getRootProps: (externalProps?: GenericHTMLProps) => GenericHTMLProps; /** * The ref to the component's root DOM element. */ rootRef: React.RefCallback<Element> | null; } }