# Autocomplete

> A text input that suggests values as the user types.

```tsx title="hero.tsx"
import {
  Autocomplete,
  AutocompleteClear,
  AutocompleteEmpty,
  AutocompleteInput,
  AutocompleteInputGroup,
  AutocompleteItem,
  AutocompleteItemText,
  AutocompleteList,
  AutocompletePopup,
  AutocompletePortal,
  AutocompletePositioner,
  AutocompleteTrigger,
} from '@langgenius/dify-ui/autocomplete'
import { Field, FieldDescription, FieldLabel } from '@langgenius/dify-ui/field'

const tags = [
  'analytics',
  'code-review',
  'compliance',
  'customer-support',
  'data-extraction',
  'document-parser',
  'internal-ops',
  'knowledge-base',
  'onboarding',
  'production',
  'rag-qa',
  'sales-assistant',
  'staging',
  'summarization',
  'ticket-triage',
  'translation',
]

export function AutocompleteHeroDemo() {
  return (
    <Field name="appTag" className="w-full max-w-72">
      <FieldLabel>App tag</FieldLabel>
      <Autocomplete items={tags} openOnInputClick>
        <AutocompleteInputGroup>
          <AutocompleteInput placeholder="e.g. customer-support" />
          <AutocompleteClear />
          <AutocompleteTrigger className="data-popup-open:bg-components-input-bg-hover data-popup-open:text-text-secondary" />
        </AutocompleteInputGroup>
        <AutocompletePortal>
          <AutocompletePositioner>
            <AutocompletePopup>
              <AutocompleteEmpty>
                No matching tag. The typed text becomes a new tag.
              </AutocompleteEmpty>
              <AutocompleteList<string>>
                {(tag) => (
                  <AutocompleteItem key={tag} value={tag}>
                    <AutocompleteItemText>{tag}</AutocompleteItemText>
                  </AutocompleteItem>
                )}
              </AutocompleteList>
            </AutocompletePopup>
          </AutocompletePositioner>
        </AutocompletePortal>
      </Autocomplete>
      <FieldDescription>Tags group apps on the Studio page.</FieldDescription>
    </Field>
  )
}
```

## Usage guidelines

- Use `Autocomplete` for free-form text with optional suggestions; the value is the typed text. Use `Combobox` to select and remember one or more values from a searchable collection, and `Select` to choose from a closed, scannable list without text entry.
- Give the input an accessible name with `FieldLabel` inside a `Field`, or `aria-label` when the layout already labels it visually.
- Pass `items` to the root so filtering and the list share one source. For groups, pass an array of `{ label, items }` objects and render them with `useAutocompleteFilteredItems`, `AutocompleteGroup` and `AutocompleteCollection`.
- Use `AutocompleteClear` in the input group to clear the typed text. `AutocompleteTrigger` is optional and opens the suggestions without typing.
- Keep `AutocompleteEmpty` when the empty state needs explanation, for example that the typed text is kept as entered. When omitting `AutocompleteEmpty`, add `data-empty:hidden` to `AutocompletePositioner` so an empty popup frame does not stay visible when nothing matches.
- The popup follows the input group width and clamps to the viewport with Base UI's `--anchor-width` and `--available-width`. Do not replace that sizing with a fixed width.

## Anatomy

```tsx
import {
  Autocomplete,
  AutocompleteClear,
  AutocompleteCollection,
  AutocompleteEmpty,
  AutocompleteGroup,
  AutocompleteGroupLabel,
  AutocompleteInput,
  AutocompleteInputGroup,
  AutocompleteItem,
  AutocompleteItemText,
  AutocompleteList,
  AutocompletePopup,
  AutocompletePortal,
  AutocompletePositioner,
  AutocompleteSeparator,
  AutocompleteStatus,
  AutocompleteTrigger,
} from '@langgenius/dify-ui/autocomplete'
```

```tsx
<Autocomplete>
  <AutocompleteInputGroup>
    <AutocompleteInput />
    <AutocompleteClear />
    <AutocompleteTrigger />
  </AutocompleteInputGroup>
  <AutocompletePortal>
    <AutocompletePositioner>
      <AutocompletePopup>
        <AutocompleteStatus />
        <AutocompleteEmpty />
        <AutocompleteList>
          <AutocompleteGroup>
            <AutocompleteGroupLabel />
            <AutocompleteCollection>
              <AutocompleteItem>
                <AutocompleteItemText />
              </AutocompleteItem>
            </AutocompleteCollection>
            <AutocompleteSeparator />
          </AutocompleteGroup>
        </AutocompleteList>
      </AutocompletePopup>
    </AutocompletePositioner>
  </AutocompletePortal>
</Autocomplete>
```

## Examples

### Grouped suggestions

Group suggestions under an `AutocompleteGroupLabel`. The filter keeps the group shape, so a group with no matches disappears.

```tsx title="groups.tsx"
import {
  Autocomplete,
  AutocompleteClear,
  AutocompleteCollection,
  AutocompleteEmpty,
  AutocompleteGroup,
  AutocompleteGroupLabel,
  AutocompleteInput,
  AutocompleteInputGroup,
  AutocompleteItem,
  AutocompleteItemText,
  AutocompleteList,
  AutocompletePopup,
  AutocompletePortal,
  AutocompletePositioner,
  AutocompleteSeparator,
  AutocompleteTrigger,
  useAutocompleteFilteredItems,
} from '@langgenius/dify-ui/autocomplete'
import { Field, FieldDescription, FieldLabel } from '@langgenius/dify-ui/field'

type HeaderSuggestion = {
  value: string
  label: string
  hint: string
}

type HeaderGroup = {
  label: string
  items: HeaderSuggestion[]
}

const headerGroups: HeaderGroup[] = [
  {
    label: 'Authentication',
    items: [
      { value: 'Authorization', label: 'Authorization', hint: 'Bearer / Basic' },
      { value: 'X-Api-Key', label: 'X-Api-Key', hint: 'API key' },
      { value: 'X-Workspace-Id', label: 'X-Workspace-Id', hint: 'Tenant scope' },
      { value: 'X-Signature-256', label: 'X-Signature-256', hint: 'Webhook HMAC' },
    ],
  },
  {
    label: 'Content & format',
    items: [
      { value: 'Accept', label: 'Accept', hint: 'Response MIME' },
      { value: 'Content-Type', label: 'Content-Type', hint: 'Payload MIME' },
      { value: 'Accept-Language', label: 'Accept-Language', hint: 'Locale' },
      { value: 'Content-Encoding', label: 'Content-Encoding', hint: 'Compression' },
      { value: 'User-Agent', label: 'User-Agent', hint: 'Client ID' },
    ],
  },
  {
    label: 'Caching & tracing',
    items: [
      { value: 'Cache-Control', label: 'Cache-Control', hint: 'Cache policy' },
      { value: 'Idempotency-Key', label: 'Idempotency-Key', hint: 'Retry safety' },
      { value: 'X-Request-Id', label: 'X-Request-Id', hint: 'Request trace' },
      { value: 'X-Forwarded-For', label: 'X-Forwarded-For', hint: 'Client IP' },
      { value: 'X-Correlation-Id', label: 'X-Correlation-Id', hint: 'Span trace' },
    ],
  },
]

function HeaderList() {
  const groups = useAutocompleteFilteredItems<HeaderGroup>()

  return (
    <AutocompleteList>
      {groups.map((group, index) => (
        <AutocompleteGroup key={group.label} items={group.items}>
          {index > 0 && <AutocompleteSeparator />}
          <AutocompleteGroupLabel>{group.label}</AutocompleteGroupLabel>
          <AutocompleteCollection<HeaderSuggestion>>
            {(header) => (
              <AutocompleteItem key={header.value} value={header}>
                <AutocompleteItemText>{header.label}</AutocompleteItemText>
                <span className="shrink-0 system-xs-regular text-text-tertiary">{header.hint}</span>
              </AutocompleteItem>
            )}
          </AutocompleteCollection>
        </AutocompleteGroup>
      ))}
    </AutocompleteList>
  )
}

export function AutocompleteGroupsDemo() {
  return (
    <Field name="httpHeader" className="w-full max-w-80">
      <FieldLabel>HTTP request header</FieldLabel>
      <Autocomplete items={headerGroups} openOnInputClick>
        <AutocompleteInputGroup>
          <AutocompleteInput placeholder="Pick a header or enter X-…" />
          <AutocompleteClear />
          <AutocompleteTrigger className="data-popup-open:bg-components-input-bg-hover data-popup-open:text-text-secondary" />
        </AutocompleteInputGroup>
        <AutocompletePortal>
          <AutocompletePositioner>
            <AutocompletePopup>
              <AutocompleteEmpty>
                No standard header matches. Your custom header name will be kept.
              </AutocompleteEmpty>
              <HeaderList />
            </AutocompletePopup>
          </AutocompletePositioner>
        </AutocompletePortal>
      </Autocomplete>
      <FieldDescription>
        Choose a standard header or type a custom header for the HTTP Request node.
      </FieldDescription>
    </Field>
  )
}
```

### Inline completion

With `mode="both"`, the input previews the highlighted suggestion while the list filters. Omitting `AutocompleteEmpty` and setting `data-empty:hidden` on `AutocompletePositioner` hides the popup cleanly when no saved instruction matches, while keeping any text the user enters.

```tsx title="inline-completion.tsx"
import {
  Autocomplete,
  AutocompleteClear,
  AutocompleteInput,
  AutocompleteInputGroup,
  AutocompleteItem,
  AutocompleteItemText,
  AutocompleteList,
  AutocompletePopup,
  AutocompletePortal,
  AutocompletePositioner,
  AutocompleteTrigger,
} from '@langgenius/dify-ui/autocomplete'
import { Field, FieldDescription, FieldLabel } from '@langgenius/dify-ui/field'

const instructions = [
  'Summarize this conversation',
  'Summarize this dataset with citations',
  'Summarize this workflow run for an operator',
  'Translate the reply into Japanese',
  'Translate the reply into Spanish',
  'Translate the product changelog into Chinese',
  'Extract invoice line items as JSON',
  'Extract action items and owners from notes',
  'Extract key entities from support tickets',
  'Rewrite this response in a concise tone',
  'Rewrite the error message for end users',
  'Classify incoming tickets by urgency',
  'Classify customer feedback by sentiment',
  'Draft a follow-up email from the transcript',
]

export function AutocompleteInlineCompletionDemo() {
  return (
    <Field name="instruction" className="w-full max-w-96">
      <FieldLabel>Instruction</FieldLabel>
      <Autocomplete items={instructions} mode="both">
        <AutocompleteInputGroup>
          <AutocompleteInput placeholder="Try “Summarize” or “Extract”…" />
          <AutocompleteClear />
          <AutocompleteTrigger className="data-popup-open:bg-components-input-bg-hover data-popup-open:text-text-secondary" />
        </AutocompleteInputGroup>
        <AutocompletePortal>
          <AutocompletePositioner className="data-empty:hidden">
            <AutocompletePopup>
              <AutocompleteList<string>>
                {(instruction) => (
                  <AutocompleteItem key={instruction} value={instruction}>
                    <AutocompleteItemText>{instruction}</AutocompleteItemText>
                  </AutocompleteItem>
                )}
              </AutocompleteList>
            </AutocompletePopup>
          </AutocompletePositioner>
        </AutocompletePortal>
      </Autocomplete>
      <FieldDescription>
        Type a prefix to preview an inline completion, or keep any custom instruction.
      </FieldDescription>
    </Field>
  )
}
```

## Keyboard

| Key                    | Action                                                                                                     |
| ---------------------- | ---------------------------------------------------------------------------------------------------------- |
| `ArrowDown`, `ArrowUp` | Opens the suggestions and moves the highlight. With `mode="both"`, the input previews the highlighted one. |
| `Enter`                | Fills the input with the highlighted suggestion and closes the suggestions.                                |
| `Escape`               | Closes the suggestions and keeps the typed text. With the suggestions closed, clears the input.            |

## API reference

### Autocomplete

Groups all parts of an autocomplete for free-form text inputs with suggestions. Doesn't render its own HTML element.

Inherits `form`, `items`, `filteredItems`, `filter`, `mode`, `inline`, `autoHighlight`, `keepHighlight`, `highlightItemOnHover`, `defaultValue`, `value`, `onValueChange`, `submitOnItemClick`, `itemToStringValue`, `actionsRef`, `onOpenChange`, `onItemHighlighted`, `openOnInputClick`, `children`, `name`, `id`, `required`, `readOnly`, `disabled`, `defaultOpen`, `open`, `onOpenChangeComplete`, `loopFocus`, `inputRef`, `grid`, `virtualized`, `modal`, `limit`, `locale` from [Base UI Autocomplete.Root](https://base-ui.com/react/components/autocomplete#root).

### AutocompleteClear

Clears the value when clicked. Renders a `<button>` element.

**Props**

| Prop    | Type                             | Default    | Description                                                            |
| ------- | -------------------------------- | ---------- | ---------------------------------------------------------------------- |
| `size?` | `'large' \| 'medium' \| 'small'` | `'medium'` | The size of the button. Match the size of the surrounding input group. |

Inherits `disabled`, `keepMounted`, `className`, `render`, `style`, `nativeButton` from [Base UI Combobox.Clear](https://base-ui.com/react/components/combobox#clear).

**Data attributes**

| Attribute             | Description                                   |
| --------------------- | --------------------------------------------- |
| `data-popup-open`     | Present when the corresponding popup is open. |
| `data-disabled`       | Present when the button is disabled.          |
| `data-visible`        | Present when the clear button is visible.     |
| `data-starting-style` | Present when the button begins animating in.  |
| `data-ending-style`   | Present when the button is animating out.     |

### AutocompleteCollection

Renders filtered list items. Doesn't render its own HTML element.

If rendering a flat list, pass a function child to the `List` component instead, which implicitly wraps it.

**Props**

| Prop       | Type                                              | Default | Description                                         |
| ---------- | ------------------------------------------------- | ------- | --------------------------------------------------- |
| `children` | `(item: Value, index: number) => React.ReactNode` | —       | Renders each item of the surrounding group or list. |

### AutocompleteEmpty

Renders its children only when the list is empty. Requires the `items` prop on the root component. Announces changes politely to screen readers. This component's root element must remain mounted in the DOM to announce changes consistently across screen readers. Avoid hiding or removing the component itself with `display: none`, `hidden`, `aria-hidden`, or conditional rendering. Prefer updating or conditionally rendering its children instead. Renders a `<div>` element.

Inherits `className`, `render`, `style` from [Base UI Combobox.Empty](https://base-ui.com/react/components/combobox#empty).

### AutocompleteGroup

Groups related items with the corresponding label. Renders a `<div>` element.

**Props**

| Prop     | Type               | Default | Description                                                                                      |
| -------- | ------------------ | ------- | ------------------------------------------------------------------------------------------------ |
| `items?` | `readonly Value[]` | —       | The items rendered within this group. Child `AutocompleteCollection` components use these items. |

Inherits `className`, `render`, `style` from [Base UI Combobox.Group](https://base-ui.com/react/components/combobox#group).

### AutocompleteGroupLabel

An accessible label that is automatically associated with its parent group. Renders a `<div>` element.

Inherits `className`, `render`, `style` from [Base UI Combobox.GroupLabel](https://base-ui.com/react/components/combobox#grouplabel).

### AutocompleteIcon

An icon that indicates that the trigger button opens the popup. Renders a `<span>` element.

Inherits `className`, `render`, `style` from [Base UI Combobox.Icon](https://base-ui.com/react/components/combobox#icon).

### AutocompleteInput

A text input to search for items in the list. Renders an `<input>` element.

**Props**

| Prop    | Type                             | Default    | Description                                                                                      |
| ------- | -------------------------------- | ---------- | ------------------------------------------------------------------------------------------------ |
| `size?` | `'large' \| 'medium' \| 'small'` | `'medium'` | The vertical padding and type scale of the input. Match the size of the surrounding input group. |

Inherits `className`, `render`, `style`, `disabled` from [Base UI Combobox.Input](https://base-ui.com/react/components/combobox#input).

**Data attributes**

| Attribute         | Description                                                                        |
| ----------------- | ---------------------------------------------------------------------------------- |
| `data-popup-open` | Present when the corresponding popup is open.                                      |
| `data-pressed`    | Present when the input is pressed.                                                 |
| `data-disabled`   | Present when the component is disabled.                                            |
| `data-readonly`   | Present when the component is readonly.                                            |
| `data-popup-side` | Indicates which side the corresponding popup is positioned relative to its anchor. |
| `data-required`   | Present when the component is required.                                            |
| `data-valid`      | Present when the component is in a valid state (when wrapped in Field.Root).       |
| `data-invalid`    | Present when the component is in an invalid state (when wrapped in Field.Root).    |
| `data-touched`    | Present when the component has been touched (when wrapped in Field.Root).          |
| `data-dirty`      | Present when the component's value has changed (when wrapped in Field.Root).       |
| `data-filled`     | Present when the component has a value (when wrapped in Field.Root).               |
| `data-focused`    | Present when the input is focused (when wrapped in Field.Root).                    |
| `data-list-empty` | Present when the corresponding items list is empty.                                |

### AutocompleteInputGroup

A wrapper for the input and its associated controls. Renders a `<div>` element.

**Props**

| Prop    | Type                             | Default    | Description                                                                                                  |
| ------- | -------------------------------- | ---------- | ------------------------------------------------------------------------------------------------------------ |
| `size?` | `'large' \| 'medium' \| 'small'` | `'medium'` | The height, padding, and corner radius of the group. Pass the same size to the input and controls inside it. |

Inherits `className`, `render`, `style` from [Base UI Autocomplete.InputGroup](https://base-ui.com/react/components/autocomplete#inputgroup).

**Data attributes**

| Attribute         | Description                                                                        |
| ----------------- | ---------------------------------------------------------------------------------- |
| `data-popup-open` | Present when the corresponding popup is open.                                      |
| `data-pressed`    | Present when the input group is pressed.                                           |
| `data-disabled`   | Present when the component is disabled.                                            |
| `data-readonly`   | Present when the component is readonly.                                            |
| `data-popup-side` | Indicates which side the corresponding popup is positioned relative to its anchor. |
| `data-valid`      | Present when the component is in a valid state (when wrapped in Field.Root).       |
| `data-invalid`    | Present when the component is in an invalid state (when wrapped in Field.Root).    |
| `data-touched`    | Present when the component has been touched (when wrapped in Field.Root).          |
| `data-dirty`      | Present when the component's value has changed (when wrapped in Field.Root).       |
| `data-filled`     | Present when the component has a value (when wrapped in Field.Root).               |
| `data-focused`    | Present when the component is focused (when wrapped in Field.Root).                |
| `data-list-empty` | Present when the corresponding items list is empty.                                |

### AutocompleteItem

An individual item in the list. Renders a `<div>` element.

**Props**

| Prop     | Type    | Default | Description                               |
| -------- | ------- | ------- | ----------------------------------------- |
| `value?` | `Value` | —       | A unique value that identifies this item. |

Inherits `className`, `render`, `style`, `nativeButton`, `children`, `index`, `disabled` from [Base UI Autocomplete.Item](https://base-ui.com/react/components/autocomplete#item).

**Data attributes**

| Attribute          | Description                           |
| ------------------ | ------------------------------------- |
| `data-highlighted` | Present when the item is highlighted. |
| `data-disabled`    | Present when the item is disabled.    |

### AutocompleteItemIndicator

Accepts the props of the element it renders.

### AutocompleteItemText

Accepts the props of the element it renders.

### AutocompleteList

A list container for the items. Renders a `<div>` element.

**Props**

| Prop        | Type                                                                   | Default | Description                                             |
| ----------- | ---------------------------------------------------------------------- | ------- | ------------------------------------------------------- |
| `children?` | `((item: Value, index: number) => React.ReactNode) \| React.ReactNode` | —       | The list content, or a function that renders each item. |

Inherits `className`, `render`, `style` from [Base UI Combobox.List](https://base-ui.com/react/components/combobox#list).

**Data attributes**

| Attribute    | Description                |
| ------------ | -------------------------- |
| `data-empty` | Whether the list is empty. |

### AutocompletePopup

A container for the list. Renders a `<div>` element.

Inherits `className`, `render`, `style`, `initialFocus`, `finalFocus` from [Base UI Combobox.Popup](https://base-ui.com/react/components/combobox#popup).

**Data attributes**

| Attribute             | Description                                                           |
| --------------------- | --------------------------------------------------------------------- |
| `data-open`           | Present when the popup is open.                                       |
| `data-closed`         | Present when the popup is closed.                                     |
| `data-starting-style` | Present when the popup begins animating in.                           |
| `data-ending-style`   | Present when the popup is animating out.                              |
| `data-side`           | Indicates which side the popup is positioned relative to the trigger. |
| `data-align`          | Indicates how the popup is aligned relative to specified side.        |
| `data-anchor-hidden`  | Present when the anchor is hidden.                                    |
| `data-empty`          | Present when the items list is empty.                                 |

### AutocompletePortal

A portal element that moves the popup to a different part of the DOM. By default, the portal element is appended to `<body>`. Renders a `<div>` element.

Inherits `keepMounted`, `container`, `className`, `render`, `style` from [Base UI Combobox.Portal](https://base-ui.com/react/components/combobox#portal).

### AutocompletePositioner

Positions the popup against the trigger. Renders a `<div>` element.

**Props**

| Prop          | Type                           | Default   | Description                                                                                             |
| ------------- | ------------------------------ | --------- | ------------------------------------------------------------------------------------------------------- |
| `align?`      | `'center' \| 'end' \| 'start'` | `'start'` | How to align the popup relative to the specified side.                                                  |
| `sideOffset?` | `number \| OffsetFunction`     | `4`       | Distance between the anchor and the popup in pixels. Also accepts a function that returns the distance. |

Inherits `className`, `render`, `style`, `anchor`, `positionMethod`, `side`, `alignOffset`, `collisionBoundary`, `collisionPadding`, `sticky`, `arrowPadding`, `disableAnchorTracking`, `collisionAvoidance` from [Base UI Combobox.Positioner](https://base-ui.com/react/components/combobox#positioner).

**Data attributes**

| Attribute            | Description                                                           |
| -------------------- | --------------------------------------------------------------------- |
| `data-open`          | Present when the popup is open.                                       |
| `data-closed`        | Present when the popup is closed.                                     |
| `data-anchor-hidden` | Present when the anchor is hidden.                                    |
| `data-side`          | Indicates which side the popup is positioned relative to the trigger. |
| `data-align`         | Indicates how the popup is aligned relative to specified side.        |
| `data-empty`         | Present when the items list is empty.                                 |

**CSS variables**

| Variable             | Type     | Description                                                                            |
| -------------------- | -------- | -------------------------------------------------------------------------------------- |
| `--available-width`  | `number` | The available width between the trigger and the edge of the viewport.                  |
| `--available-height` | `number` | The available height between the trigger and the edge of the viewport.                 |
| `--anchor-width`     | `number` | The anchor's width.                                                                    |
| `--anchor-height`    | `number` | The anchor's height.                                                                   |
| `--transform-origin` | `string` | The coordinates that this element is anchored to. Used for animations and transitions. |

### AutocompleteRow

Displays a single row of items in a grid list. Enable `grid` on the root component to turn the listbox into a grid. Renders a `<div>` element.

Inherits `className`, `render`, `style` from [Base UI Combobox.Row](https://base-ui.com/react/components/combobox#row).

### AutocompleteSeparator

A visual separator between items or groups. Renders a `<div>` element.

Inherits `orientation`, `className`, `render`, `style` from [Base UI Autocomplete.Separator](https://base-ui.com/react/components/autocomplete#separator).

**Data attributes**

| Attribute          | Description                       |
| ------------------ | --------------------------------- |
| `data-orientation` | The orientation of the separator. |

### AutocompleteStatus

Displays a status message whose content changes are announced politely to screen readers. Useful for conveying the status of an asynchronously loaded list. This component's root element must remain mounted in the DOM to announce changes consistently across screen readers. Avoid hiding or removing the component itself with `display: none`, `hidden`, `aria-hidden`, or conditional rendering. Prefer updating or conditionally rendering its children instead. Renders a `<div>` element.

Inherits `className`, `render`, `style` from [Base UI Combobox.Status](https://base-ui.com/react/components/combobox#status).

### AutocompleteTrigger

A button that opens the popup. Renders a `<button>` element.

**Props**

| Prop    | Type                             | Default    | Description                                                            |
| ------- | -------------------------------- | ---------- | ---------------------------------------------------------------------- |
| `size?` | `'large' \| 'medium' \| 'small'` | `'medium'` | The size of the button. Match the size of the surrounding input group. |

Inherits `disabled`, `className`, `render`, `style`, `nativeButton` from [Base UI Autocomplete.Trigger](https://base-ui.com/react/components/autocomplete#trigger).

**Data attributes**

| Attribute         | Description                                                                        |
| ----------------- | ---------------------------------------------------------------------------------- |
| `data-popup-open` | Present when the corresponding popup is open.                                      |
| `data-pressed`    | Present when the trigger is pressed.                                               |
| `data-disabled`   | Present when the component is disabled.                                            |
| `data-readonly`   | Present when the component is readonly.                                            |
| `data-popup-side` | Indicates which side the corresponding popup is positioned relative to its anchor. |
| `data-required`   | Present when the component is required.                                            |
| `data-valid`      | Present when the component is in a valid state (when wrapped in Field.Root).       |
| `data-invalid`    | Present when the component is in an invalid state (when wrapped in Field.Root).    |
| `data-touched`    | Present when the component has been touched (when wrapped in Field.Root).          |
| `data-dirty`      | Present when the component's value has changed (when wrapped in Field.Root).       |
| `data-filled`     | Present when the component has a value (when wrapped in Field.Root).               |
| `data-focused`    | Present when the trigger is focused (when wrapped in Field.Root).                  |
| `data-list-empty` | Present when the corresponding items list is empty.                                |

### AutocompleteValue

The current value of the autocomplete. Doesn't render its own HTML element.

Inherits `children` from [Base UI Autocomplete.Value](https://base-ui.com/react/components/autocomplete#value).

### useAutocompleteFilter

```ts
useAutocompleteFilter(options?: GetFilterParameters): Filter
```

**Parameters**

| Parameter  | Type                  | Description |
| ---------- | --------------------- | ----------- |
| `options?` | `GetFilterParameters` | —           |

**Returns:** `Filter`

**Return properties**

| Member       | Type                                                                                  | Description                                          |
| ------------ | ------------------------------------------------------------------------------------- | ---------------------------------------------------- |
| `contains`   | `<Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean` | Returns whether the item matches the query anywhere. |
| `startsWith` | `<Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean` | Returns whether the item starts with the query.      |
| `endsWith`   | `<Item>(item: Item, query: string, itemToString?: (item: Item) => string) => boolean` | Returns whether the item ends with the query.        |

### useAutocompleteFilteredItems

```ts
useAutocompleteFilteredItems<Value>(): readonly Value[]
```

**Returns:** `readonly Value[]`
