Search
A search form with an input and a button, and room for a select before it.
Data
Added in v0.76.3
Updated
Default
{component search, action: '/search', placeholder: 'Title, author, subject' /}
A form that sends a GET request to action, the current page when it is empty. The input is named name (q by default) and holds value, so a results page can show what was searched. label is the accessible name of the form and the input, and button is the button's text. For results as people type, put hx-get, hx-trigger and hx-target in attrs.
A scope and your own button
{component search, action: '/search', placeholder: 'Search the catalogue'}
{block scope}
{ui select,
name: 'scope',
options: ['keyword' => 'Keywords', 'author' => 'Author', 'subject' => 'Subject'],
/}
{/block}
{block actions}
{ui button, icon: 'search', type: submit, class: 'button-icon', attrs: ['aria-label' => 'Search'] /}
{/block}
{/component}
{block scope} goes before the input, for a select that narrows the search, and {block actions} replaces the button. Give id when two searches share a page, such as one in the header and one in the page, since the input's id is its name by default.