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.
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.
| Type | Description | |
|---|---|---|
variant | "default" "hero" "compact" | (optional) Choose default, hero for a large search, or compact to expand on focus and while results or a query are present. Defaults to default. |
shortcut | boolean | (optional) 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. |
Search.Input#
Supports Input properties and 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 and 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.
| Type | Description | |
|---|---|---|
minHeight | number string | (optional) 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. |
maxHeight | number string | (optional) 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. |
panelDescription | string | (required) 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. |
align | "left" "center" "right" | (optional) 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. |
children | ({ results: React.ReactNode, close: () => void }) => React.ReactNode | (optional) 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. |
popoverProps | object | (optional) Configure the underlying Popover 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. |
Translations#
More info about translations can be found in the general localization and Eufemia Forms localization docs.
| Key | nb-NO | en-GB | sv-SE | da-DK |
|---|---|---|---|---|
Search.label | Søk | Search | Sök | Søg |
Search.placeholder | Søk ... | Search ... | Sök ... | Søg ... |
Autocomplete-specific translations follow Autocomplete.