---
title: Search
description: Search content with suggestions, a hero input, or a compact input that expands on focus.
version: 11.19.0
generatedAt: 2026-11-26T22:30:05.997Z
checksum: 313ac28c00c3e5407133ffd46d47b4b3d7320e587748ff81871d0c39736d0b95
---

# Search

## Overview

Search helps people find content. Choose `Search.Input` for a search field, `Search.Autocomplete` for suggestions as people type, or `Search.Panel` to combine suggestions with filters and sorting. All three keep the query on blur, have a translated screen reader label, and support the same variants, shortcut hint, and focus expansion.

Give the component a descriptive `label`, such as "Search products", when the search scope needs explanation. Set `labelSrOnly={false}` to show the label.

### Import

```tsx
import { Search } from '@dnb/eufemia'

<Search.Input label="Search products" />
<Search.Autocomplete label="Search products" data={['Cards', 'Loans']} />
<Search.Panel
  label="Search products"
  panelDescription="Product results. Use the arrow keys to navigate results."
  data={['Cards', 'Loans']}
/>
```

The namespace export follows [List](/web/components/list). A production bundler includes the parts you use. `Search.Input` uses Input and does not include Autocomplete or DrawerList. Using `Search.Autocomplete` or `Search.Panel` opts in to those dependencies. The Search.Panel implementation is excluded when you use either of the other components.

You can also import each component directly:

```tsx
import SearchInput from '@dnb/eufemia/components/search/SearchInput'
import SearchAutocomplete from '@dnb/eufemia/components/search/SearchAutocomplete'
import SearchPanel from '@dnb/eufemia/components/search/SearchPanel'
```

### Relevant links

- [Source code](https://github.com/dnbexperience/eufemia/tree/main/packages/dnb-eufemia/src/components/search)
- [Input events](/web/components/input/events)
- [Autocomplete events](/web/components/autocomplete/events)

### Behavior

#### Input behavior

Search.Input builds on [Input](/web/components/input). Use `onChange` to receive the query and `onSubmit` to search when Enter is pressed. It renders a native search input without a suggestions list. All Search components default to a Search keyboard action without autocapitalization, autocorrection, or spellcheck. Native input props can override these defaults.

#### Autocomplete behavior

Search.Autocomplete builds on [Autocomplete](/web/components/autocomplete), including accessible suggestions, keyboard navigation, loading indicators, clear buttons, and asynchronous results. Provide `data` for local suggestions or use `mode="async"` and `onType` to load results. Use `onChange` to open a selected result and `onSubmit` to handle a query without a selected result. Selecting a result does not replace the query by default.

For a fixed or sticky header, set `fixedPosition` on Search.Autocomplete or `popoverProps={{ fixedPosition: true }}` on Search.Panel. This keeps results attached to the input while the page scrolls. Leave it disabled for inputs in normal page flow.

#### Panel behavior

Search.Panel combines Autocomplete's inline results with [Popover](/web/components/popover). It opens on focus when results are available and includes Popover's close button. Results render through a React portal, avoiding clipping by the input's container. The rounded panel uses the same corner radius and horizontal padding as Filter.Panel, with a 0.5rem gap below the input and space for the close button. The surface aligns with the input's left edge by default. Set `align="center"` or `align="right"` to change this; the surface stays inside the viewport. Use a render function to place filters, sorting, or actions around the provided `results`. These controls stay outside the listbox and retain their own keyboard behavior.

```tsx
<Search.Panel
  label="Search products"
  panelDescription="Product results. Use the arrow keys to navigate results."
  data={['Cards', 'Loans']}
>
  {({ results }) => (
    <Flex.Stack>
      <P>Choose a product</P>
      {results}
    </Flex.Stack>
  )}
</Search.Panel>
```

The results grow with their content into the available space above or below the input. The panel reserves room for custom controls, padding, and the close button, and scrolls the results when needed. It keeps its opening direction while open and updates the available height when the page scrolls or the viewport changes, including when a mobile keyboard opens. The results have a minimum height of 10rem, configurable with `minHeight`. This minimum is reduced when less space is available on the opening side. The panel scrolls when custom controls need more room. It closes if the opening side has less than 7rem available, keeping focus in the input. Use `minHeight={0}` for the natural height of a short list. Set `maxHeight={16}` to cap the results at 16rem. A smaller explicit `maxHeight` takes precedence over `minHeight`.

The panel defaults to a maximum width of 32rem, including the hero variant. Use `popoverProps.className` to customize the surface width.

Up and Down navigate results while the input has focus, and Enter selects a result. Pressing text or empty space in the panel keeps focus in the input. Tab moves between the input and custom controls without trapping focus. Escape closes the results and returns focus to the input. See the [sorting and filter example](/web/components/search/demos#panel-with-filtering-and-sorting).

Provide the required `panelDescription` in the user's language. Describe what the panel contains, including any filters, sorting, or other actions, and how to reach them. For example: "Search results include category filters and sorting. Use the arrow keys to navigate results and press Tab to reach the filters and sorting controls." The input exposes this description to screen readers even before results are available. It supplements the input's label and any existing help or status text. Autocomplete separately announces the number of available results through a live region as results change, including asynchronous updates.

For asynchronous results, use `mode="async"` and load data in `onType`, just like Search.Autocomplete. An empty panel stays closed on focus and while waiting for results. Use `showIndicator()` for a loading indicator inside the input. Call `updateData()` when results arrive, or `showNoOptionsItem()` for an explicit no-results message. Use `showIndicatorItem()` if the loading state should appear inside the panel instead. See the [asynchronous examples](/web/components/search/demos#asynchronous-results).

#### Variants

All three components accept `variant="default"`, `variant="hero"` for a large input that fills its container, or `variant="compact"` for an input that expands on focus. Compact stays expanded while it has a query or the suggestions are open. Reduced motion preferences disable the width transition.

All variants use the theme's normal corner radius.

Set `--search-width` and `--search-compact-width` to customize the expanded and collapsed widths. Their defaults are `17.5rem` and `11rem`. Widths are limited to the available container. `stretch` fills the container in every state.

#### Keyboard shortcut

Set `shortcut` to enable Cmd+K on Mac and Ctrl+K elsewhere and display a platform-specific hint inside the input. The shortcut leaves other focused text fields and editors alone. If several Search components enable the shortcut, the first visible, enabled input in document order receives focus. When a modal is open, the shortcut stays within that modal. Enable it on the primary search in a page. The shortcut hint is hidden on small screens and while the input has content.

When the shortcut moves focus into Search, Escape closes open results first. Press Escape again to return focus to the original control without clearing the query. An empty compact input collapses after losing focus; a query keeps it expanded.


### Related components

Search is part of the [Inputs](/web/components/overview/#input) category. More components in this category:

- [Autocomplete](/web/components/autocomplete/) – to help people find and choose from matching suggestions as they type.
- [Checkbox](/web/components/checkbox/) – when people can turn one or more options on or off.
- [Chip](/web/components/chip/) – to select compact options and filters.
- [Date picker](/web/components/date-picker/) – when people need to choose one date or a date range.
- [Dropdown](/web/components/dropdown/) – when people need to choose one option from a list.
- [Filter](/web/components/filter/) – to help people narrow down a list or data set.

[See all in Inputs](/web/components/overview/#input)


## Demos

### Default

Compare the three search components. `Search.Input` provides a search field without suggestions and supports Input's `onChange` and `onSubmit` events. `Search.Autocomplete` adds suggestions, while `Search.Panel` presents them in a flexible panel.

Autocomplete and DrawerList dependencies are excluded when only `Search.Input` is used in a production bundle.


```tsx
render(<Flex.Stack layoutEngine="css" wrap={false}>
      <Flex.Stack layoutEngine="css" wrap={false} gap="x-small" data-visual-test="search-default" data-testid="search-default">
        <P>Search.Input</P>
        <Search.Input label="Search content" />
      </Flex.Stack>
      <Flex.Stack layoutEngine="css" wrap={false} gap="x-small" data-visual-test="search-autocomplete" data-testid="search-autocomplete">
        <P>Search.Autocomplete</P>
        <Search.Autocomplete label="Search components" data={['Button', 'Input', 'Table']} />
      </Flex.Stack>
      <Flex.Stack layoutEngine="css" wrap={false} gap="x-small" data-visual-test="search-panel-default" data-testid="search-panel-default">
        <P>Search.Panel</P>
        <Search.Panel label="Search components in a panel" panelDescription="Use the arrow keys to navigate search results." data={['Button', 'Input', 'Table']} />
      </Flex.Stack>
    </Flex.Stack>)
```


### Compact with shortcut

All three components expand on focus and display the shortcut inside the input. When several examples enable the shortcut, Cmd+K or Ctrl+K focuses the first visible one. The Portal header owns the shortcut on this page. Open the examples in fullscreen to try their shortcuts.

With `labelSrOnly={false}`, a vertical label keeps the expanded width while only the input changes width. This keeps wrapping and the input's vertical position stable.


```tsx
render(<Flex.Stack layoutEngine="css" wrap={false}>
      <Flex.Stack layoutEngine="css" wrap={false} gap="x-small" data-visual-test="search-compact" data-testid="search-compact">
        <P>Search.Input</P>
        <Search.Input variant="compact" shortcut label="Search content" />
      </Flex.Stack>
      <Flex.Stack layoutEngine="css" wrap={false} gap="x-small" data-visual-test="search-autocomplete-compact" data-testid="search-autocomplete-compact">
        <P>Search.Autocomplete</P>
        <Search.Autocomplete variant="compact" shortcut label="Search components" data={['Button', 'Input', 'Table']} />
      </Flex.Stack>
      <Flex.Stack layoutEngine="css" wrap={false} gap="x-small" data-visual-test="search-panel-compact" data-testid="search-panel-compact">
        <P>Search.Panel</P>
        <Search.Panel variant="compact" shortcut label="Search components in a panel" panelDescription="Use the arrow keys to navigate search results." data={['Button', 'Input', 'Table']} />
      </Flex.Stack>
    </Flex.Stack>)
```


### Hero

Use the hero variant for a prominent search field, such as a home page search. It supports the same suggestions, panel, and keyboard shortcut behavior.


```tsx
render(<Flex.Stack layoutEngine="css" wrap={false}>
      <Flex.Stack layoutEngine="css" wrap={false} gap="x-small" data-visual-test="search-hero" data-testid="search-hero">
        <P>Search.Input</P>
        <Search.Input variant="hero" shortcut label="Search components and guidance" placeholder="Search components and guidance" />
      </Flex.Stack>
      <Flex.Stack layoutEngine="css" wrap={false} gap="x-small" data-visual-test="search-autocomplete-hero" data-testid="search-autocomplete-hero">
        <P>Search.Autocomplete</P>
        <Search.Autocomplete variant="hero" shortcut label="Search components and guidance" placeholder="Search components and guidance" data={['Button', 'Input', 'Table']} />
      </Flex.Stack>
      <Flex.Stack layoutEngine="css" wrap={false} gap="x-small" data-visual-test="search-panel-hero" data-testid="search-panel-hero">
        <P>Search.Panel</P>
        <Search.Panel variant="hero" shortcut label="Search components and guidance in a panel" placeholder="Search components and guidance" panelDescription="Use the arrow keys to navigate search results." data={['Button', 'Input', 'Table']} />
      </Flex.Stack>
    </Flex.Stack>)
```


### Panel with filtering and sorting

Use a panel when results need additional controls. This example filters by category with [Chip.Group](/web/components/chip/) and sorts by relevance or alphabetically. The controls belong to the application, so the component also works with other filters or actions.

The required `panelDescription` tells screen reader users what they can find in the panel and how to reach its controls. Describe the controls your application provides and supply the text in the user's language. Result counts are announced separately.

The render function receives `results`, the inline Autocomplete list, and `close`. Keep controls outside `results` so they retain their own keyboard behavior. Up and Down navigate results while the input has focus, Enter selects, and Tab reaches the controls. Category chips keep focus when selected; return to the input to type a query. Escape closes the surface and returns focus to the input.


```tsx
const Example = () => {
  const categoryLabelId = useId();
  const [category, setCategory] = useState('all');
  const [sort, setSort] = useState('relevance');
  const sortLabel = sort === 'relevance' ? 'Relevance' : 'Alphabetical';
  const [selected, setSelected] = useState('');
  const items = [{
    content: 'Input',
    category: 'components'
  }, {
    content: 'Button',
    category: 'components'
  }, {
    content: 'Table',
    category: 'components'
  }, {
    content: 'Accessibility',
    category: 'guidance'
  }, {
    content: 'Getting started',
    category: 'guidance'
  }, {
    content: 'Card',
    category: 'components'
  }, {
    content: 'Checkbox',
    category: 'components'
  }, {
    content: 'Dialog',
    category: 'components'
  }, {
    content: 'Drawer',
    category: 'components'
  }, {
    content: 'Dropdown',
    category: 'components'
  }, {
    content: 'Icon',
    category: 'components'
  }, {
    content: 'Radio',
    category: 'components'
  }, {
    content: 'Slider',
    category: 'components'
  }, {
    content: 'Switch',
    category: 'components'
  }, {
    content: 'Tooltip',
    category: 'components'
  }, {
    content: 'Colors',
    category: 'guidance'
  }, {
    content: 'Forms',
    category: 'guidance'
  }, {
    content: 'Layout',
    category: 'guidance'
  }, {
    content: 'Spacing',
    category: 'guidance'
  }, {
    content: 'Typography',
    category: 'guidance'
  }];
  const data = items.filter(item => category === 'all' || item.category === category);
  if (sort === 'alphabetical') {
    data.sort((a, b) => a.content.localeCompare(b.content));
  }
  return <Flex.Stack layoutEngine="css" wrap={false} data-testid="search-panel">
            <Search.Panel variant="compact" shortcut label="Search with filters" panelDescription="Search results include category filters and sorting. Use the arrow keys to navigate results and press Tab to reach the filters and sorting controls." data={data} search={{
      reorder: sort === 'relevance'
    }} onChange={({
      data
    }) => {
      if (data && typeof data !== 'string') {
        setSelected(String(data.content));
      }
    }}>
              {({
        results
      }) => <Flex.Stack layoutEngine="css" wrap={false} gap="small">
                  <Flex.Container layoutEngine="css" justify="space-between" align="center" gap="x-small" wrap>
                    <FormLabel id={categoryLabelId} element="span" vertical={false} right={false}>
                      Show results from
                    </FormLabel>
                    <Flex.Item style={{
            marginLeft: 'auto'
          }}>
                      <Menu.Root alignOnTarget="right" arrowPosition="right" arrowPositionSelector=".dnb-button__icon">
                        <Menu.Button variant="tertiary" icon="chevron_down" text={sortLabel} aria-label={`Sort results: ${sortLabel}`} />
                        <Menu.List aria-label="Sort results" style={{
                whiteSpace: 'nowrap'
              }}>
                          <Menu.Action text="Relevance" icon={sort === 'relevance' ? 'check' : undefined} onClick={() => setSort('relevance')} />
                          <Menu.Action text="Alphabetical" icon={sort === 'alphabetical' ? 'check' : undefined} onClick={() => setSort('alphabetical')} />
                        </Menu.List>
                      </Menu.Root>
                    </Flex.Item>
                  </Flex.Container>
                  <Chip.Group aria-labelledby={categoryLabelId} value={category} onChange={({
          value
        }) => setCategory(String(value))}>
                    <Chip value="all">All</Chip>
                    <Chip value="components">Components</Chip>
                    <Chip value="guidance">Guidance</Chip>
                  </Chip.Group>
                  {results}
                </Flex.Stack>}
            </Search.Panel>
            <P aria-live="polite">
              {selected ? `Selected: ${selected}` : 'Select a result to try the search.'}
            </P>
          </Flex.Stack>;
};
render(<Example />);
```


### Asynchronous results

Both Search.Autocomplete and Search.Panel support `mode="async"`. These examples simulate a delayed response with Autocomplete's managed `debounce` method. Focusing an empty input keeps the results closed. The input shows a loading indicator while waiting, then opens the results or an explicit no-results message. Clearing the query closes the results and cancels the pending response.

The `onType` callback receives the same result and loading methods as Autocomplete. For remote results, see [loading data asynchronously](/web/components/autocomplete/events#dynamically-change-data). Ignore outdated responses when a newer query is typed or the input is cleared.


```tsx
const onType = ({
  value,
  event,
  updateData,
  setHidden,
  setVisible,
  showIndicator,
  hideIndicator,
  showNoOptionsItem,
  debounce
}) => {
  if (value.trim()) {
    showIndicator();
  } else {
    updateData([]);
    setHidden();
    hideIndicator();
  }
  debounce(({
    value,
    input
  }) => {
    if (!value.trim()) {
      return;
    }
    const results = ['Button', 'Input', 'Table'].filter(item => item.toLowerCase().includes(value.trim().toLowerCase()));
    if (document.activeElement === input) {
      setVisible();
    }
    updateData(results);
    hideIndicator();
    if (!results.length) {
      showNoOptionsItem();
    }
  }, {
    value,
    input: event.target
  }, 500);
};
render(<Flex.Stack layoutEngine="css" wrap={false} data-testid="search-async">
          <Search.Autocomplete label="Search components asynchronously" labelSrOnly={false} mode="async" onType={onType} />
          <Search.Panel label="Search components asynchronously in a panel" panelDescription="Search results appear after typing. Use the arrow keys to navigate results." labelSrOnly={false} variant="compact" shortcut mode="async" onType={onType} />
        </Flex.Stack>);
```



  <div data-testid="search-panel-fixed">
    
```tsx
render(<Search.Panel variant="compact" label="Search components in a fixed panel" popoverProps={{
  fixedPosition: true
}} panelDescription="Use the arrow keys to navigate search results." data={['Button', 'Input', 'Table']} />)
```

  </div>

<!-- eufemia-properties-usage:start -->
Some properties provide flexibility for specific integrations. Follow the component's usage guidance. Customizations beyond the documented patterns need a use case approved by DNB UX. [Read about intended use and customization](/web/styling-and-themes/configuration/component-properties/#intended-use-and-customization).
<!-- eufemia-properties-usage:end -->

## Properties

### Shared properties

These properties apply to `Search.Input`, `Search.Autocomplete`, and `Search.Panel`. All default to `size="medium"`, `labelSrOnly`, and `showClearButton`. A custom `submitElement` or `showSubmitButton` replaces the shortcut hint.


```json
{
  "props": {
    "variant": {
      "doc": "Choose `default`, `hero` for a large search, or `compact` to expand on focus and while results or a query are present. Defaults to `default`.",
      "type": [
        "\"default\"",
        "\"hero\"",
        "\"compact\""
      ],
      "status": "optional"
    },
    "shortcut": {
      "doc": "Enable Cmd+K on Mac and Ctrl+K elsewhere to focus the first visible, enabled Search with a shortcut. Leaves shortcuts to other focused text fields and editors. Shows a platform-specific hint when the input is empty. Defaults to `false`.",
      "type": "boolean",
      "status": "optional"
    }
  },
  "usageGuidance": "Some properties provide flexibility for specific integrations. Follow the component's usage guidance. Customizations beyond the documented patterns need a use case approved by DNB UX. [Read about intended use and customization](/web/styling-and-themes/configuration/component-properties/#intended-use-and-customization)."
}
```


### Search.Input

Supports [Input properties](/web/components/input/properties) and [events](/web/components/input/events). It defaults to `type="search"` with a loupe icon. Use `value` to update the query, `ref` to access the input, `onChange` for query changes, and `onSubmit` for submission.

### Search.Autocomplete

Supports [Autocomplete properties](/web/components/autocomplete/properties) and [events](/web/components/autocomplete/events). It also defaults to `preventSelection`, `keepValue`, `noScrollAnimation`, and `showAll={false}`, so filtered results do not end with an item that lists every option. With `mode="async"`, it defaults to `search={{ filter: false }}` and shows every result as provided, since the source has already filtered them. Other `search` options are kept. Use `inputValue` to update the query, `inputRef` to access the input, `onType` for query changes, and `onChange` for result selection.

### Search.Panel

Supports the same Autocomplete properties and events as `Search.Autocomplete`, including the `showAll` and asynchronous `search` defaults, with `openOnFocus` enabled by default. It owns `inline`, `resultsRender`, `skipPortal`, and `preventClose` to compose the results inside the panel. Keyboard navigation keeps visible results in place and smoothly scrolls results into view at the edge. Scrolling respects reduced motion; use `noScrollAnimation` to disable it. Use `popoverProps` for the supported surface options.


```json
{
  "props": {
    "minHeight": {
      "doc": "Minimum results height in rem. Defaults to `10` and is reduced to fit the available space on the opening side. A smaller explicit `maxHeight` takes precedence. Use `0` to let a short results list keep its natural height.",
      "type": [
        "number",
        "string"
      ],
      "status": "optional"
    },
    "maxHeight": {
      "doc": "Optional maximum results height in rem. Results otherwise grow into the available viewport space above or below the input, reserving room for custom controls and padding. The available space and a smaller explicit maximum take precedence over `minHeight`.",
      "type": [
        "number",
        "string"
      ],
      "status": "optional"
    },
    "panelDescription": {
      "doc": "Describe the results and any controls available in the panel, such as filtering and sorting. Include how to reach those controls with Tab. This screen reader description is attached to the input, including while the panel is closed. Provide localized text. Result counts are announced separately by Autocomplete.",
      "type": "string",
      "status": "required"
    },
    "align": {
      "doc": "Align the results surface with the input using `left`, `center`, or `right`. Defaults to `left`. The surface stays within the viewport when there is insufficient space.",
      "type": [
        "\"left\"",
        "\"center\"",
        "\"right\""
      ],
      "status": "optional"
    },
    "children": {
      "doc": "Render custom controls alongside `results`, the inline Autocomplete list. Keep controls outside the listbox. The `close` callback closes the surface. Defaults to rendering only the results.",
      "type": "({ results: React.ReactNode, close: () => void }) => React.ReactNode",
      "status": "optional"
    },
    "popoverProps": {
      "doc": "Configure the underlying [Popover](/web/components/popover/properties) with `fixedPosition`, `placement`, `triggerOffset`, `autoAlignMode`, `className`, or `noAnimation`. Use `fixedPosition: true` for a fixed or sticky header. Defaults to `triggerOffset: 8` pixels and `autoAlignMode: \"initial\"`, keeping the opening direction while the panel is open.",
      "type": "object",
      "status": "optional"
    }
  }
}
```


### Translations


```json
{
  "locales": [
    "da-DK",
    "en-GB",
    "nb-NO",
    "sv-SE"
  ],
  "entries": {
    "Search.label": {
      "nb-NO": "Søk",
      "en-GB": "Search",
      "sv-SE": "Sök",
      "da-DK": "Søg"
    },
    "Search.placeholder": {
      "nb-NO": "Søk ...",
      "en-GB": "Search ...",
      "sv-SE": "Sök ...",
      "da-DK": "Søg ..."
    }
  }
}
```


Autocomplete-specific translations follow [Autocomplete](/web/components/autocomplete/properties#translations).

## Events

Search components use the events of their underlying components. All support `onFocus`, `onBlur`, `onClear`, and `onSubmit`.

### Search.Input

Use `onChange` to receive query changes and `onSubmit` to handle Enter. Both receive an object containing `value` and `event`.

Inside a form, Enter also submits the form, as in any native search input. Call `event.preventDefault()` in `onSubmit` to handle the query without submitting the form. Search.Autocomplete and Search.Panel do not submit a surrounding form.


```json
{
  "props": {
    "onChange": {
      "doc": "Will be called on value changes made by the user. Returns an object with the value as a string and the native event: `{ value, event }`.",
      "type": "function",
      "status": "optional"
    },
    "onFocus": {
      "doc": "Will be called on focus set by the user. Returns `{ value, event }`.",
      "type": "function",
      "status": "optional"
    },
    "onKeyDown": {
      "doc": "Will be called on key down by the user. Returns `{ value, event }`.",
      "type": "function",
      "status": "optional"
    },
    "onBlur": {
      "doc": "Will be called on blur set by the user. Returns `{ value, event }`.",
      "type": "function",
      "status": "optional"
    },
    "onSubmit": {
      "doc": "Will be called on enter key press, and on submit button click when a submit button is shown. Returns `{ value, event }`.",
      "type": "function",
      "status": "optional"
    },
    "onSubmitFocus": {
      "doc": "Will be called on submit button focus. Only relevant when a submit button is shown. Returns `{ value, event }`. Not called in Safari, which only focuses buttons on Tab or click when \"Press Tab to highlight each item on a web page\" is enabled in the Advanced settings in Safari.",
      "type": "function",
      "status": "optional"
    },
    "onSubmitBlur": {
      "doc": "Will be called on submit button blur. Only relevant when a submit button is shown. Returns `{ value, event }`. Not called in Safari, which only focuses buttons on Tab or click when \"Press Tab to highlight each item on a web page\" is enabled in the Advanced settings in Safari.",
      "type": "function",
      "status": "optional"
    },
    "onClear": {
      "doc": "Will be called on a clear button click. Returns `{ value, previousValue, event }`.",
      "type": "function",
      "status": "optional"
    }
  }
}
```


See [Input events](/web/components/input/events) for details about changing or preventing an input value.

### Search.Autocomplete and Search.Panel

Use `onType` to receive query changes and load suggestions. Use `onChange` to handle a confirmed result, and `onSelect` to follow the active result during keyboard navigation.

`onSubmit` handles Enter when no result is active or selected. Selecting a result keeps the query by default.

With `mode="async"`, use `updateData` when results arrive and `showNoOptionsItem` when the search returns no results. `showIndicator` displays loading inside the input without opening an empty panel. Clearing an asynchronous query should clear the data, hide loading, and ignore any pending response.


```json
{
  "props": {
    "onType": {
      "doc": "Will be called for every key change the user makes. Returns an object with the input `value` inside `{ value, event, attributes }` including [these methods](/web/components/autocomplete/events#dynamically-change-data).",
      "type": "function",
      "status": "optional"
    },
    "onFocus": {
      "doc": "Will be called on user generated focus action. Returns an object with the input `value` inside `{ value, event, attributes }` including [these methods](/web/components/autocomplete/events#dynamically-change-data).",
      "type": "function",
      "status": "optional"
    },
    "onBlur": {
      "doc": "Will be called on user generated blur action. Returns an object with the input `value` inside `{ value, event, attributes }` including [these methods](/web/components/autocomplete/events#dynamically-change-data).",
      "type": "function",
      "status": "optional"
    },
    "onChange": {
      "doc": "Will be called on state changes made by the user. Returns an object with the new selected `data` item `{ data, event, attributes, value }` including [these methods](/web/components/autocomplete/events#dynamically-change-data).",
      "type": "function",
      "status": "optional"
    },
    "onSelect": {
      "doc": "Will be called once the user focuses or selects an item by a click or keyboard navigation. Returns an object with the new selected `data` item `{ data, event, attributes, value, activeItem, selectedItem }` including [these methods](/web/components/autocomplete/events#dynamically-change-data). The \"activeItem\" property is the currently selected item by keyboard navigation.",
      "type": "function",
      "status": "optional"
    },
    "onOpen": {
      "doc": "Will be called once the user presses the autocomplete. Returns the data item `{ data, attributes }`.",
      "type": "function",
      "status": "optional"
    },
    "onClose": {
      "doc": "Will be called once the user presses the autocomplete again, or clicks somewhere else. Returns the data item `{ data, attributes }`.",
      "type": "function",
      "status": "optional"
    },
    "onClear": {
      "doc": "Will be called on a clear button click. Returns `{ value, previousValue, event }`.",
      "type": "function",
      "status": "optional"
    },
    "onSubmit": {
      "doc": "Will be called when the user presses Enter in the input field without selecting an item from the list. Useful for triggering custom actions like navigating to a search results page. Returns `{ value, event, attributes }` including [these methods](/web/components/autocomplete/events#dynamically-change-data).",
      "type": "function",
      "status": "optional"
    },
    "onItemMouseEnter": {
      "doc": "Will be called when the mouse enters a dropdown item. Useful for pre-fetching data on hover. Returns `{ item, data, event }` where `item` is the item index and `data` is the item data.",
      "type": "function",
      "status": "optional"
    }
  }
}
```


The callbacks also provide methods such as `updateData`, `showIndicator`, `hideIndicator`, and `setHidden`. Search.Panel also passes `close` to its children render function for custom actions that close the surface. See [Autocomplete events](/web/components/autocomplete/events) and [dynamically changing data](/web/components/autocomplete/events#dynamically-change-data).
