warning_amberDeprecated
SelectV1 component is deprecated and will no longer be updated.
You can use SelectV1 instead.
Usage
Import
import { SelectV1 } from '@passfort/castle'
Single SelectV1
function Example() {
const items = [
{
label: 'Alex W.',
id: 'rmc',
},
{
label: 'Stephen N.',
id: 'uxd',
},
{
label: 'David K.',
id: 'hux',
},
]
return <SelectV1 initialValue={items[0]} items={items} />
}
live example
Controlled Single SelectV1
function Example() {
const [value, setValue] = React.useState()
React.useEffect(() => {
console.log('value', value)
}, [value])
return <SelectV1 value={value} onSelect={setValue} items={selectUsers} />
}
live example
Search SelectV1
<SelectV1
showSearch
items={selectUsers}
onSelect={(item) => console.log('item', item)}
/>
live example
Controlled
function Example() {
const [value, setValue] = React.useState()
React.useEffect(() => {
console.log('value', value)
}, [value])
return (
<SelectV1
showSearch
value={value}
onSelect={setValue}
items={selectUsers}
/>
)
}
live example
FormControl
<FormControls>
<FormControl isDisabled>
<FormLabel>Search</FormLabel>
<SelectV1 showSearch items={selectUsers} />
</FormControl>
<FormControl isDisabled>
<FormLabel>Single</FormLabel>
<SelectV1 items={selectUsers} />
</FormControl>
</FormControls>
live example