Quaff

QSearch

Search bars open a dedicated view for queries, suggestions, and results. Choose a docked or fullscreen layout to fit your interface.

info QSearch API Source


expressive
?: boolean = undefined
Uses the contained search style. Otherwise uses the divided style. Inherits the Quaff.init() expressive setting when omitted.

labels
?: Partial<QSearchLabels> = undefined
Overrides the language pack's accessible labels for the back and clear actions, results region, and loading announcement.

layout
?: "auto" | "docked" | "fullscreen" = "auto"
Uses full-screen search below 600px and a docked view otherwise.

loading
?: boolean = false
Marks the results as busy and displays a progress indicator.

onsearch
?: (query: string) => void = undefined
Runs when Enter is pressed or the snippet's search function is called. The view stays open and focus moves to the results.

open
?: boolean = $bindable(false)
Whether the search view is open. Supports two-way binding. Native validation also opens an invalid field.

placeholder
?: HTMLInputAttributes["placeholder"] = undefined
Placeholder for an empty query. Defaults to the language pack's search placeholder.

status
?: string = undefined
Announces result counts or empty states to assistive technology. Update this when results change.

value
?: string = $bindable("")
The search query. Supports two-way binding.

Usage

Accessibility

The default placeholder and accessible labels follow the language pack and translations.search configured with Quaff.init(). Use placeholder and labels to override them for an individual search.

Give each search a meaningful aria-label. QSearch manages the search field, opening and closing the view, focus restoration, and the clear action. Your application supplies filtering and result content through the children snippet; use status for a short result-count announcement.

Press Enter to submit a query and Escape to close the view. Tab reaches filters and result actions. The examples reuse QList and QItem for arrow-key navigation inside a result list. Call the snippet's close function after choosing a result when the next step belongs outside search.