Autocomplete.Root
Low-level primitive for an autocomplete input that suggests options as
you type. Unlike `Combobox`, the input can contain free-form text and
suggestions only optionally autocomplete the text.
There are currently no plans for higher-level components of this primitive in this package.
Use the primitives directly, and remember to label the input field,
usually by using the `Field` component.
Prop types (react-component-meta)
34 prop types
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Root
Props:
/**
* A ref to imperative actions.
* - `unmount`: Ends the closing phase of the autocomplete after an externally controlled closing animation finishes.
* Call `preventUnmountOnClose()` in `onOpenChange` first, otherwise the autocomplete completes closing on its own.
* Whether it leaves the DOM is decided by `keepMounted` on the portal.
* - `close`: Closes the autocomplete imperatively when called.
*/
actionsRef?: RefObject<AutocompleteRootActions | null>
/**
* Whether the first matching item is highlighted automatically.
* - `true`: highlight after the user types and keep the highlight while the query changes.
* - `'always'`: always highlight the first item.
*/
autoHighlight?: boolean | "always" | undefined = false
children?: ReactNode
/**
* Whether the popup is initially open.
*
* To render a controlled popup, use the `open` prop instead.
*/
defaultOpen?: boolean = false
/**
* The uncontrolled input value of the autocomplete when it's initially rendered.
*
* To render a controlled autocomplete, use the `value` prop instead.
*/
defaultValue?: string | number | readonly string[] | undefined
/**
* Whether the component should ignore user interaction.
*/
disabled?: boolean = false
/**
* Filter function used to match items against the input query.
*/
filter?: ((item: unknown, query: string, itemToString?: ((item: unknown) => string) | undefined) => boolean) | null | undefined
/**
* Filtered items to display in the list.
* When provided, the list uses these items instead of filtering the `items` prop internally.
* When `items` is also provided, this array must preserve its flat or grouped structure.
* Nullish entries are not supported, as in `items`.
* Use when you want to control filtering logic externally with the `useFilter()` hook.
*/
filteredItems?: readonly unknown[] | readonly Group<unknown>[] | undefined
/**
* Identifies the form that owns the internal input.
* Useful when the autocomplete is rendered outside the form.
*/
form?: string
/**
* Whether list items are presented in a grid layout.
* When enabled, arrow keys navigate across rows and columns inferred from DOM rows.
*/
grid?: boolean = false
/**
* Whether moving the pointer over items should highlight them.
* Disabling this prop allows CSS `:hover` to be differentiated from the `:focus` (`data-highlighted`) state.
*/
highlightItemOnHover?: boolean = true
/**
* The id of the component.
*/
id?: string
/**
* Whether the list is rendered inline without using the component's own popup.
*
* Specify `open` unconditionally in conjunction with this prop so the list is considered
* visible: `<Autocomplete.Root inline open>`
*/
inline?: boolean = false
/**
* A ref to the hidden input element.
*/
inputRef?: Ref<HTMLInputElement> | undefined
/**
* The items to be displayed in the list.
* Can be either a flat array of items or an array of groups with items.
* Nullish entries are not supported: remove them from the data before passing it.
*/
items?: readonly unknown[]
/**
* When the item values are objects (`<Autocomplete.Item value={object}>`), this function converts the object value to a string representation for both display in the input and form submission.
* If the shape of the object is `{ value, label }`, the label will be used automatically without needing to specify this prop.
*/
itemToStringValue?: (itemValue: unknown) => string
/**
* Whether the highlighted item should be preserved when the pointer leaves the list.
*/
keepHighlight?: boolean = false
/**
* The maximum number of items to display in the list.
*/
limit?: number = -1
/**
* The locale to use for string comparison.
* Defaults to the user's runtime locale.
*/
locale?: LocalesArgument
/**
* Whether to loop keyboard focus back to the input when the end of the list is reached while using the arrow keys. The first item can then be reached by pressing <kbd>ArrowDown</kbd> again from the input, or the last item can be reached by pressing <kbd>ArrowUp</kbd> from the input.
* The input is always included in the focus loop per [ARIA Authoring Practices](https://www.w3.org/WAI/ARIA/apg/patterns/combobox/).
* When disabled, focus does not move when on the last element and the user presses <kbd>ArrowDown</kbd>, or when on the first element and the user presses <kbd>ArrowUp</kbd>.
*/
loopFocus?: boolean = true
/**
* Determines if the popup enters a modal state when open.
* - `true`: user interaction is limited to the popup: document page scroll is locked and pointer interactions on outside elements are disabled.
* - `false`: user interaction with the rest of the document is allowed.
*
* On touch devices, a `true` modal blocks outside taps but leaves the page scrollable unless the popup spans nearly the full viewport width, matching native iOS behavior.
*/
modal?: boolean = false
/**
* Controls how the autocomplete behaves with respect to list filtering and inline autocompletion.
* - `list` (default): items are dynamically filtered based on the input value. The input value does not change based on the active item.
* - `both`: items are dynamically filtered based on the input value, which will temporarily change based on the active item (inline autocompletion).
* - `inline`: items are static (not filtered), and the input value will temporarily change based on the active item (inline autocompletion).
* - `none`: items are static (not filtered), and the input value will not change based on the active item.
*/
mode?: "list" | "none" | "inline" | "both" = 'list'
/**
* Identifies the field when a form is submitted.
*/
name?: string
/**
* Callback fired when an item is highlighted or unhighlighted.
* Receives the highlighted item value (or `undefined` if no item is highlighted) and event details with a `reason` property describing why the highlight changed.
* The `reason` can be:
* - `'keyboard'`: the highlight changed due to keyboard navigation.
* - `'pointer'`: the highlight changed due to pointer hovering. The event may be a `MouseEvent`
* rather than a `PointerEvent`.
* - `'none'`: the highlight changed for another reason, such as typing, `autoHighlight`, the
* item list changing, or the popup opening or closing.
*/
onItemHighlighted?: (highlightedValue: unknown, eventDetails: HighlightEventDetails) => void
/**
* Event handler called when the popup is opened or closed.
*/
onOpenChange?: (open: boolean, eventDetails: AutocompleteRootOpenChangeEventDetails) => void
/**
* Event handler called after any animations complete when the popup is opened or closed.
*/
onOpenChangeComplete?: (open: boolean) => void
/**
* Event handler called when the input value of the autocomplete changes.
*/
onValueChange?: (value: string, eventDetails: AutocompleteRootChangeEventDetails) => void
/**
* Whether the popup is currently open. Use when controlled.
*/
open?: boolean
/**
* Whether the popup opens when clicking the input.
*/
openOnInputClick?: boolean = false
/**
* Whether the user should be unable to choose a different option from the popup.
*/
readOnly?: boolean = false
/**
* Whether the user must choose a value before submitting a form.
*/
required?: boolean = false
/**
* Whether clicking an item should submit the autocomplete's owning form.
* By default, clicking an item via a pointer or <kbd>Enter</kbd> key does not submit the owning form.
* Useful when the autocomplete is used as a single-field form search input.
*/
submitOnItemClick?: boolean = false
/**
* The input value of the autocomplete. Use when controlled.
*/
value?: string | number | readonly string[] | undefined
/**
* Whether the items are being externally virtualized.
*/
virtualized?: boolean = false
Autocomplete.Portal
5 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
Used to apply custom portal behavior to `Autocomplete`'s popup content.
`container` defaults to the `@wordpress/ui` compat overlay slot.
import { Portal } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Portal (react-component-meta)
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* A parent element to render the portal element into.
*/
container?: HTMLElement | ShadowRoot | RefObject<HTMLElement | ShadowRoot | null> | null | undefined
/**
* Whether to keep the portal mounted in the DOM while the popup is hidden.
*/
keepMounted?: boolean = false
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.Positioner
15 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
Used to apply custom positioning to `Autocomplete`'s popup content.
import { Positioner } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Positioner (react-component-meta)
/**
* How to align the popup relative to the specified side.
*/
align?: "center" | "end" | "start" = 'center'
/**
* Additional offset along the alignment axis in pixels.
* Also accepts a function that returns the offset to read the dimensions of the anchor
* and positioner elements, along with its side and alignment.
*
* The function takes a `data` object parameter with the following properties:
* - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`.
* - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`.
* - `data.side`: which side of the anchor element the positioner is aligned against.
* - `data.align`: how the positioner is aligned relative to the specified side.
*/
alignOffset?: number | OffsetFunction | undefined = 0
/**
* An element to position the popup against.
* By default, the popup will be positioned against the trigger.
*/
anchor?: Element | VirtualElement | RefObject<Element | null> | (() => Element | VirtualElement | null) | null | undefined
/**
* Minimum distance to maintain between the arrow and the edges of the popup.
*
* Use it to prevent the arrow element from hanging out of the rounded corners of a popup.
*/
arrowPadding?: number = 5
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Determines how to handle collisions when positioning the popup.
*
* `side` controls overflow on the preferred placement axis (`top`/`bottom` or `left`/`right`):
* - `'flip'`: keep the requested side when it fits; otherwise try the opposite side
* (`top` and `bottom`, or `left` and `right`).
* - `'shift'`: never change side; keep the requested side and move the popup within
* the clipping boundary so it stays visible.
* - `'none'`: do not correct side-axis overflow.
*
* `align` controls overflow on the alignment axis (`start`/`center`/`end`):
* - `'flip'`: keep side, but swap `start` and `end` when the requested alignment overflows.
* - `'shift'`: keep side and requested alignment, then nudge the popup along the
* alignment axis to fit.
* - `'none'`: do not correct alignment-axis overflow.
*
* `fallbackAxisSide` controls fallback behavior on the perpendicular axis when the
* preferred axis cannot fit:
* - `'start'`: allow perpendicular fallback and try the logical start side first
* (`top` before `bottom`, or `left` before `right` in LTR).
* - `'end'`: allow perpendicular fallback and try the logical end side first
* (`bottom` before `top`, or `right` before `left` in LTR).
* - `'none'`: do not fallback to the perpendicular axis.
*
* When `side` is `'shift'`, explicitly setting `align` only supports `'shift'` or `'none'`.
* If `align` is omitted, it defaults to `'flip'`.
*/
collisionAvoidance?: CollisionAvoidance | undefined
/**
* An element or a rectangle that delimits the area that the popup is confined to.
*/
collisionBoundary?: Boundary | undefined = 'clipping-ancestors'
/**
* Additional space to maintain from the edge of the collision boundary.
*/
collisionPadding?: Padding | undefined = 5
/**
* Whether to disable the popup from tracking any layout shift of its positioning anchor.
*/
disableAnchorTracking?: boolean = false
/**
* Determines which CSS `position` property to use.
*/
positionMethod?: "fixed" | "absolute" = 'absolute'
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* Which side of the anchor element to align the popup against.
* May automatically change to avoid collisions.
*/
side?: "left" | "right" | "bottom" | "top" | "inline-end" | "inline-start" = 'bottom'
/**
* Distance between the anchor and the popup in pixels.
* Also accepts a function that returns the distance to read the dimensions of the anchor
* and positioner elements, along with its side and alignment.
*
* The function takes a `data` object parameter with the following properties:
* - `data.anchor`: the dimensions of the anchor element with properties `width` and `height`.
* - `data.positioner`: the dimensions of the positioner element with properties `width` and `height`.
* - `data.side`: which side of the anchor element the positioner is aligned against.
* - `data.align`: how the positioner is aligned relative to the specified side.
*/
sideOffset?: number | OffsetFunction | undefined = 0
/**
* Whether to maintain the popup in the viewport after
* the anchor element was scrolled out of view.
*/
sticky?: boolean = false
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.Popup
9 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
import { Popup } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Popup (react-component-meta)
children?: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Determines the element to focus when the popup is closed.
*
* - `false`: Do not move focus.
* - `true`: Move focus based on the default behavior (trigger or previously focused element).
* - `RefObject`: Move focus to the ref element.
* - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).
* Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing.
*/
finalFocus?: boolean | RefObject<HTMLElement | null> | ((closeType: InteractionType) => boolean | void | HTMLElement | null) | undefined
/**
* Determines the element to focus when the popup is opened.
*
* - `false`: Do not move focus.
* - `true`: Move focus based on the default behavior (first tabbable element or popup).
* - `RefObject`: Move focus to the ref element.
* - `function`: Called with the interaction type (`mouse`, `touch`, `pen`, or `keyboard`).
* Return an element to focus, `true` to use the default behavior, or `false`/`undefined` to do nothing.
*/
initialFocus?: boolean | RefObject<HTMLElement | null> | ((openType: InteractionType) => boolean | void | HTMLElement | null) | undefined
/**
* Optional portal element, typically `<Autocomplete.Portal />` with custom
* `container`. When omitted, `Autocomplete.Popup` uses
* `Autocomplete.Portal` with default props. Do not pass `children` on the
* portal element; they would be ignored.
*/
portal?: ReactElement<Omit<PortalProps, "children">, string | JSXElementConstructor<any>>
/**
* Optional positioner element, typically `<Autocomplete.Positioner />`
* with custom positioning props (`side`, `align`, `sideOffset`, collision
* settings, etc.). When omitted, `Autocomplete.Popup` uses
* `Autocomplete.Positioner` with default props. Do not pass `children` on
* the positioner element; they would be ignored.
*/
positioner?: ReactElement<Omit<PositionerProps, "children">, string | JSXElementConstructor<any>>
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
/**
* Controls how the popup width is constrained relative to its anchor.
*
* For all presets, the popup is never narrower than its anchor.
*
* - `'anchor'`: Fixed width matching the anchor width.
* - `'content'`: Width grows with item labels between the anchor and available
* viewport bounds.
* - `'sm'`: Fixed width at the small surface width token (`--wpds-dimension-surface-width-sm`).
* - `'md'`: Fixed width at the medium surface width token (`--wpds-dimension-surface-width-md`).
* - `'lg'`: Fixed width at the large surface width token (`--wpds-dimension-surface-width-lg`).
* - `'available'`: Fixed width at the available viewport width (`--available-width`).
*/
width?: "anchor" | "content" | "sm" | "md" | "lg" | "available" = 'anchor'
Autocomplete.Input
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
import { Input } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Input (react-component-meta)
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Whether the component should ignore user interaction.
*/
disabled?: boolean = false
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined = ( props: AutocompleteInputProps ) => (
<InputPrimitive { ...props } />
)
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.InputGroup
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
Wrapper around `Autocomplete.Input` that defines the visual control
boundary when the input is composed with prefix/suffix slots or other
elements. Without this wrapper, the popup anchors to the bare `<input>`
instead of the full control. Also adds `role="group"`.
import { InputGroup } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::InputGroup (react-component-meta)
children?: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.List
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
import { List } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::List (react-component-meta)
children?: ReactNode | ((item: any, index: number) => ReactNode)
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.ListBody
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
A layout container for the main scrolling area in the `List`, for holding `Item`s.
import { ListBody } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::ListBody (react-component-meta)
children?: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.Collection
1 prop type
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
import { Collection } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Collection (react-component-meta)
children: (item: any, index: number) => ReactNode
Autocomplete.Group
5 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
Groups related items together with an associated label rendered by
`Autocomplete.GroupLabel`. When `items` is provided, child
`Autocomplete.Collection` components iterate over them.
import { Group } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Group (react-component-meta)
children?: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Items to be rendered within this group.
* When provided, child `Collection` components will use these items.
*/
items?: readonly any[]
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.GroupLabel
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
Renders a label for an `Autocomplete.Group`, describing the group of items
it is associated with.
import { GroupLabel } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::GroupLabel (react-component-meta)
children?: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.Item
9 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
import { Item } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Item (react-component-meta)
/**
* One direct ItemLabel, followed by zero or more ItemDescription components.
*/
children: AutocompleteItemChildren
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Whether the component should ignore user interaction.
*/
disabled?: boolean = false
/**
* 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
/**
* Whether the component renders a native `<button>` element when replacing it
* via the `render` prop.
* Set to `true` if the rendered element is a native button.
*/
nativeButton?: boolean = false
/**
* 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?: (event: BaseUIEvent<MouseEvent<HTMLDivElement, MouseEvent>>) => void
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
/**
* A unique value that identifies this item.
*/
value?: any = null
Autocomplete.ItemLabel
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
The primary label and accessible name of an autocomplete item.
import { ItemLabel } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::ItemLabel (react-component-meta)
/**
* The primary label and accessible name of an autocomplete item.
*/
children: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.ItemDescription
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
Supplementary content for an autocomplete item. Its text contributes to the
item's accessible description.
import { ItemDescription } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::ItemDescription (react-component-meta)
/**
* Content that contributes to the autocomplete item's accessible description.
*/
children: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.Row
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
Groups multiple `Autocomplete.Item` cells into a single row in a grid
layout. Enable `grid` on `Autocomplete.Root` to turn the listbox into a
grid and use two-dimensional keyboard navigation.
import { Row } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Row (react-component-meta)
children?: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.Separator
3 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
Renders a visual separator between autocomplete items or groups.
import { Separator } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Separator (react-component-meta)
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.Value
1 prop type
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
import { Value } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Value (react-component-meta)
children?: ReactNode | ((value: string) => ReactNode)
Autocomplete.Empty
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
import { Empty } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Empty (react-component-meta)
children?: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.Status
4 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
Announces a status message politely to screen readers. Use it for the
status of an asynchronously loaded list.
Keep this element mounted. Do not hide it with `display: none`, `hidden`,
`aria-hidden`, or by omitting the component. Change or omit the children
instead.
import { Status } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Status (react-component-meta)
children?: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined
/**
* CSS style to apply to the element.
*/
style?: CSSProperties
Autocomplete.Clear
7 prop types
/home/runner/work/gutenberg/gutenberg/packages/ui/src/form/primitives/autocomplete/index.ts
A button that clears the input value.
import { Clear } from '@wordpress/ui';
Component: ../packages/ui/src/form/primitives/autocomplete/index.ts::Clear (react-component-meta)
children?: ReactNode
/**
* CSS class name to apply to the element.
*/
className?: string
/**
* Whether the component should ignore user interaction.
*/
disabled?: boolean = false
/**
* Whether the component should remain mounted in the DOM when not visible.
*/
keepMounted?: boolean = false
/**
* Whether the component renders a native `<button>` element when replacing it
* via the `render` prop.
* Set to `false` if the rendered element is not a button (for example, `<div>`).
*/
nativeButton?: boolean = true
/**
* Replaces the component's default HTML element using a given React
* element, or a function that returns a React element.
*/
render?: ComponentRenderFn<HTMLAttributesWithRef<any>> | ReactElement<Record<string, unknown>, string | JSXElementConstructor<any>> | undefined = (
{
'aria-label': ariaLabel = __( 'Clear' ),
...props
}: AutocompleteClearProps,
{ disabled }: _Autocomplete.Clear.State
) => (
<IconButton
icon={ closeSmall }
focusableWhenDisabled={ false }
disabled={ disabled }
aria-hidden={ disabled || undefined }
size="small"
variant="minimal"
tone="neutral"
label={ ariaLabel }
{ ...props }
/>
)
/**
* CSS style to apply to the element.
*/
style?: CSSProperties