Components
SearchField
SearchField provides a dedicated search input with a value-first callback, aligned with SwiftUI's searchable input patterns while remaining an explicit web control.
Example
Requires React 18.2+ or 19 and shared styles. See setup.
Default
Loading preview…
Code
'use client';
import { SearchField } from '@swiftuijs/ui';
export default function Example() {
return (<SearchField label="Search" placeholder="Find coffee" value="Flat white"></SearchField>);
}Status: adapted
Usage and limitations
onValueChangesupports SwiftUI-style state updates.onSubmitreceives the current query when the user presses Enter.- Under the hood the component uses a native
input[type="search"].
More examples
Empty
API reference
| Prop | Type | Required | Description |
|---|---|---|---|
label | string | Yes | Accessible label for the search field. |
value | string | No | Current search text. |
placeholder | string | No | Placeholder text shown when the field is empty. |
onChange | (event: ChangeEvent<HTMLInputElement>) => void | No | Standard change handler for web-style form integrations. |
onValueChange | (value: string) => void | No | Value-first change handler for SwiftUI-style state updates. |
onSubmit | (value: string) => void | No | Called when the user submits the current query with Enter. |
Inherits additional props from Omit<IBaseElementComponent<'input'>, 'children' | 'onChange' | 'onSubmit' | 'type'>.