Search Field
A search field with a magnifier, a button that clears it and an optional Cancel. It's a Liquid Glass capsule on iOS 26, and can sit in the dock to search from the bottom of the screen, as iPhone apps do.
Installation
Usage
[(value)]follows every keystroke, and setting the signal from code updates the field.- The keyboard's return key reads Search, and pressing it emits
submittedwith the text and closes the keyboard. - A clear button shows while there's text. It empties the field and keeps the keyboard up, as UIKit's does.
cancelableadds a Cancel that shows while the field is in use (focused, or holding text). It clears the field, closes the keyboard and emitscanceled.- A field the keyboard would cover rises above it while it's focused (see The keyboard).
What each platform draws
Glass belongs to the controls that float over your content. On iOS 26, put the field where it floats: at the top of a screen over its content, or in the dock.
Signal Forms
UiSearchField implements Angular's FormValueControl, so it works with the [formField] directive of Signal Forms (see Forms):
Focus from code
focus() gives the field the keyboard, and blur() takes it away. hasFocus() says whether it has it:
The keyboard
Lynx doesn't move a field the keyboard covers, so the field does it: when the keyboard shows, it measures where it is on screen and rises above the keyboard by however much it would be covered, and settles when the keyboard closes. A field at the top of the screen stays where it is. In the dock, the whole dock rises with it.
It reads the keyboard's height from its <input>'s keyboardheightchange event, which iOS measures from the bottom of the window and Android from the bottom of the Lynx view. On Android, an app whose window already shrinks above the keyboard, as the one ng build --platform android makes does, reports nothing to rise by. See Forms for the keyboard elsewhere.
Dark mode
The icons draw with the light theme's colors until you say otherwise. If your app switches to dark mode, set the color scheme with provideIconTheme().
API
UiSearchField
Accessibility
- The text box is a search field to screen readers (the
searchtrait on iOS), named by its placeholder. - The clear button and Cancel are buttons, named by
clearLabelandcancelLabel. Material's back arrow is the Cancel. - Reduce Motion: Cancel appears and the field rises above the keyboard at once, without growing or sliding.
- Increase Contrast draws the glass field's magnifier and placeholder at full strength. Reduce Transparency is handled by the glass.
