Search bar¶
The search bar allows users to quickly find content using free text.
Usage¶

When to use¶
- Use it if a full text search is required.
Best practices¶
- Ignore punctuation within searches.
- Combine with the typeahead behavior to assist users when searching.
- Don't use wildcard encoding for more complex search statements.
- Consider adding other search capabilities according to project needs (e.g. use quotes to search for exact matches).
- The placement of the Search Bar depends on the layout of the viewport. See the list-details for placement guidance. See data table for search placement within a data table.
Design¶
Elements¶

- Search icon, 2. Content, 3. Container, 4. Clear button
Interaction states¶
The search bar container color should always be in contrast with its surrounding background. Use background-2 or background-1 accordingly.

Code¶
Use a native input with siSearchBarInput inside si-search-bar. Bind a reactive FormControl or a Signal Forms field to the input to manage its value, validation, and disabled state. Observe form value changes to trigger searches and debounce them in application code when needed.
Set [showIcon]="true" on si-search-bar to display a search icon. The icon is hidden by default.
Usage¶
import {
SiSearchBarComponent,
SiSearchBarInputDirective
} from '@siemens/element-ng/search-bar';
@Component({
imports: [SiSearchBarComponent, SiSearchBarInputDirective, ...]
})
Projected input¶
Apply input settings directly to the projected input. Keep appearance settings, such as showIcon and colorVariant, on si-search-bar:
<si-search-bar [showIcon]="true">
<input
siSearchBarInput
aria-label="Search users"
placeholder="Search users"
maxlength="40"
[readonly]="readonly"
[disabled]="disabled"
/>
</si-search-bar>
Provide an accessible name with aria-label or an associated <label>; the placeholder does not replace a label. Native attributes such as autocomplete can also be set directly on the input.
Migrate deprecated inputs and outputs¶
Run the following schematic to migrate the deprecated inputs and outputs of si-search-bar to a projected input. Use --path to limit the migration to a directory.
ng g @siemens/element-ng:migrate-search-bar
The schematic:
- Moves
placeholder,maxlength,readonly,disabled, andvalue, as well as form, typeahead, andaria-*bindings, to a projected<input siSearchBarInput>. - Replaces
(searchChange)with a Signal Forms field in the component class. Thedebouncerule replacesdebounceTime, thepatternrule replacesprohibitedCharacters, and aneffectcalls the former handler when the search term changes. - Adds
SiSearchBarInputDirective, andFormFieldif needed, to the imports of the component or NgModule.
By default, the search bar debounces form value changes by 400 ms. A projected input updates its form value immediately, so the schematic logs each migrated search bar with a form binding that loses this debounce. Debounce the value changes in your code where needed.
The schematic also logs search bars that need a manual migration, for example if the (searchChange) handler uses template variables or is inside a @for block or conditional control flow (@if, @switch, or *ngIf). Conditional handlers stay unchanged to preserve template type narrowing.
Search Bar - Input Value¶
Set the initial value on the projected input's FormControl or Signal Forms model. The clear button resets the bound form value to an empty string.
import { SiSearchBarComponent } from '@siemens/element-ng/search-bar'; Input Properties¶
| Name | Type | Default | Description |
|---|---|---|---|
| clearButtonAriaLabel ¶ | TranslatableString | $localize`:@@SI_SEARCH_BAR.CLEAR_BUTTON:Clear` | Aria label for the clear button. |
| colorVariant ¶ | BackgroundColorVariant | 'base-1' | Color to use for component background |
| debounceTimedeprecated ¶ | number | 400 | Time unit change of search input takes effect. Deprecated: Use a content-projected input and debounce its form value changes in application code, for example with RxJS |
| disableddeprecated ¶ | boolean | false | Whether the input is disabled. Deprecated: Use a content-projected input with |
| maxlengthdeprecated ¶ | number | undefined | Defines the maximum length of the search input. Deprecated: Use a content-projected input with |
| placeholderdeprecated ¶ | string | '' | Define search input placeholder. Deprecated: Use a content-projected input with |
| prohibitedCharactersdeprecated ¶ | string | undefined | Prohibited characters restricting search. Deprecated: Use a reactive Or with Signal Forms: | |
| readonlydeprecated ¶ | boolean | false | Whether the input can be focused but not edited. Deprecated: Use a content-projected input with |
| showIcon ¶ | boolean | false | Display search icon before search input. |
| valuedeprecated ¶ | string | undefined | Define search input content. Deprecated: Use a content-projected input with |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| searchChangedeprecated ¶ | string | Output callback event will provide you with search term if search input changes. Deprecated: Use a content-projected input and observe Or with Signal Forms: |
Types Documentation¶
Use this type with filter components colorVariant to render component variants based on background of container
Represents a translatable string. This can either be a translation key, e.g. ACTIONS.EDIT that will be automatically translated when displayed on the UI or a pre-translated string, e.g. Edit. Equivalent to a normal string in usage and functionality.
Except where otherwise noted, content on this site is licensed under MIT License.