-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a SearchControl component and reuse accross the UI (#32935)
- Loading branch information
1 parent
d249fad
commit 2356b2d
Showing
24 changed files
with
322 additions
and
190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 0 additions & 65 deletions
65
packages/block-editor/src/components/inserter/search-form.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# SearchControl | ||
|
||
SearchControl components let users display a search control. | ||
|
||
|
||
## Table of contents | ||
|
||
1. [Development guidelines](#development-guidelines) | ||
2. [Related components](#related-components) | ||
|
||
## Development guidelines | ||
|
||
### Usage | ||
|
||
Render a user interface to input the name of an additional css class. | ||
|
||
```js | ||
import { SearchControl } from '@wordpress/components'; | ||
import { useState } from '@wordpress/element'; | ||
|
||
function MySearchControl( { className, setState } ) { | ||
const [ searchInput, setSearchInput ] = useState( '' ); | ||
|
||
return ( | ||
<SearchControl | ||
value={ searchInput } | ||
onChange={ setSearchInput } | ||
/> | ||
); | ||
} | ||
``` | ||
|
||
### Props | ||
|
||
The set of props accepted by the component will be specified below. | ||
Props not included in this set will be applied to the input element. | ||
|
||
#### label | ||
|
||
If this property is added, a label will be generated using label property as the content. | ||
|
||
- Type: `String` | ||
- Required: Yes | ||
|
||
#### placeholder | ||
|
||
If this property is added, a specific placeholder will be used for the input. | ||
|
||
- Type: `String` | ||
- Required: No | ||
#### value | ||
|
||
The current value of the input. | ||
|
||
- Type: `String | Number` | ||
- Required: Yes | ||
|
||
#### className | ||
|
||
The class that will be added to the classes of the wrapper div. | ||
|
||
- Type: `String` | ||
- Required: No | ||
|
||
#### onChange | ||
|
||
A function that receives the value of the input. | ||
|
||
- Type: `function` | ||
- Required: Yes | ||
|
||
#### help | ||
|
||
If this property is added, a help text will be generated using help property as the content. | ||
|
||
- Type: `String|WPElement` | ||
- Required: No | ||
### hideLabelFromVision | ||
|
||
If true, the label will only be visible to screen readers. | ||
|
||
- Type: `Boolean` | ||
- Required: No | ||
|
||
## Related components | ||
|
||
- To offer users more constrained options for input, use TextControl, SelectControl, RadioControl, CheckboxControl, or RangeControl. |
Oops, something went wrong.