UNPKG

@base-ui/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.

47 lines 1.6 kB
import * as React from 'react'; import type { BaseUIComponentProps, NonNativeButtonProps } from "../../utils/types.js"; /** * An individual item in the list. * Renders a `<div>` element. */ export declare const ComboboxItem: React.NamedExoticComponent<Omit<ComboboxItemProps, "ref"> & React.RefAttributes<HTMLDivElement>>; export interface ComboboxItemState { /** * Whether the item should ignore user interaction. */ disabled: boolean; /** * Whether the item is selected. */ selected: boolean; /** * Whether the item is highlighted. */ highlighted: boolean; } export interface ComboboxItemProps extends NonNativeButtonProps, Omit<BaseUIComponentProps<'div', ComboboxItem.State>, 'id'> { children?: React.ReactNode; /** * An optional click handler for the item when selected. * It fires when clicking the item with the pointer, as well as when pressing `Enter` with the keyboard if the item is highlighted when the `Input` or `List` element has focus. */ onClick?: BaseUIComponentProps<'div', ComboboxItemState>['onClick'] | undefined; /** * The index of the item in the list. Improves performance when specified by avoiding the need to calculate the index automatically from the DOM. */ index?: number | undefined; /** * A unique value that identifies this item. * @default null */ value?: any; /** * Whether the component should ignore user interaction. * @default false */ disabled?: boolean | undefined; } export declare namespace ComboboxItem { type State = ComboboxItemState; type Props = ComboboxItemProps; }