Search
The Scripting app supports advanced search interactions similar to SwiftUI. You can add a search bar, control its visibility and placement, react to changes in input, and display dynamic suggestions.
searchable
Marks a view as searchable by displaying a search field and binding it to a state value.
Type
Description
- Displays a search field in the view (typically above a
<List>). - The
valueis the current search query, which you control via state. - The
onChangedcallback updates the state when the user types. - Optionally provide a
promptas placeholder text. - Use
placementto customize where the search field appears. - Use
presentedto programmatically show or dismiss the search field.
Example
SearchFieldPlacement options
searchSuggestions
Displays a list of suggestions below the search field as the user types.
Type
Description
Use this to return a list of suggestions, typically based on the user's input.
Example
searchSuggestionsVisibility
Controls when and where search suggestions are shown.
Type
SearchSuggestionsPlacementSet options
Example
searchCompletion
Associates a tappable search suggestion with a complete search query string.
Type
Description
Apply this modifier to suggestion views (such as <Text>) to indicate what value should be filled into the search field when the user taps the suggestion.
Example
When tapped, this will set the search field to "Mango".
Summary
These modifiers work together to create a responsive, interactive search experience in any scrollable view like <List>.
