SearchControl components let users display a search control.
Import
import { SearchControl } from '@wordpress/components';
Props
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
label | unknown | __( 'Search' ) | ||
placeholder | unknown | __( 'Search' ) | ||
hideLabelFromVision | unknown | true | ||
size | unknown | 'default' |
Examples
Default
const Default = ( {
onChange,
...props
} ) => {
const [ value, setValue ] = useState< string >();
return (
<SearchControl
{ ...props }
value={ value }
onChange={ ( ...changeArgs ) => {
setValue( ...changeArgs );
onChange( ...changeArgs );
} }
/>
);
};