<search-bar>
A search field with a magnifying glass; name= publishes what is typed, Return fires submit.
<column style="gap-12">
<search-bar name="q"
placeholder="Search recipes"/>
<text @text="$q == '' ? 'Try pasta or curry' : 'Searching for ' + $q"
style="muted"></text>
</column>
Attributes
| Name | What it does | Default |
|---|---|---|
name |
Variable name for form scoping string |
|
placeholder |
Placeholder text string |
Search… |
value |
Initial value string |
Readings
| Name | What it does |
|---|---|
error |
The validation message for the text; empty when valid. |
focused |
Whether the field has the keyboard focus. |
length |
How many characters are in the field, live. |
max_length |
The max-length= in force (a code input: its length=), in characters; empty when none. |
valid |
Whether the text passes the field's rules (required, min-length, pattern …); true with no rules. |
value |
The text in the field, live as it is typed. |
Any tag also takes gestures: @on.tap, @on.longpress, @on.doubletap and @on.swipeleft (and right, up and down). @click runs on a tap too.