SearchBar
import { SearchBar } from "material.slint";export component Example inherits Window { width: 300px; height: 100px; background: transparent; SearchBar { placeholder: "Search..."; width: 280px; height: 56px; }}

A SearchBar
is a text input field designed for search functionality, with optional leading/trailing icons and avatar.
Properties
Section titled “Properties”avatar
Section titled “avatar”image default: the empty image
An optional avatar image displayed in the search bar.
avatar-background
Section titled “avatar-background”color default: #00000000
The background color for the avatar.
current-item
Section titled “current-item”int (in-out)
default: 0
The index of the currently selected search result item.
empty-text
Section titled “empty-text”string default: ""
Text displayed when there are no search results.
[struct ListItem] default: a struct with all default values
ListItem
This structure represents a ListItem with a text, supporting text, avatar icon, avatar text, avatar background, avatar foreground, and action icon.
text
(string): The text to display in the item.supporting_text
(string): The supporting text to display in the item.avatar-icon
(image): The avatar icon to display in the item.avatar-text
(string): The avatar text to display in the item.avatar-background
(color): The avatar background color to display in the item.avatar-foreground
(color): The avatar foreground color to display in the item.action-icon
(image): The action icon to display in the item.
An array of search result items to display.
leading-icon
Section titled “leading-icon”image default: the empty image
The icon displayed at the start of the search bar.
placeholder
Section titled “placeholder”string default: ""
The placeholder text displayed when the search bar is empty.
string (in-out)
default: ""
The current text in the search bar.
trailing-icon
Section titled “trailing-icon”image default: the empty image
The icon displayed at the end of the search bar.
Callbacks
Section titled “Callbacks”action(index: int)
Section titled “action(index: int)”Invoked when a search result item action is triggered.
accepted(text: string)
Section titled “accepted(text: string)”Invoked when the user presses Enter in the search bar.
edited(text: string)
Section titled “edited(text: string)”Invoked when the text in the search bar changes.
key-pressed(event: KeyEvent) -> EventResult
Section titled “key-pressed(event: KeyEvent) -> EventResult”Invoked when a key is pressed in the search bar.
key-released(event: KeyEvent) -> EventResult
Section titled “key-released(event: KeyEvent) -> EventResult”Invoked when a key is released in the search bar.
© 2025 SixtyFPS GmbH