Select
The Select component provides a way for the user to choose between several options within a dropdown.
Props
Examples
import { whisper } from '@oliveai/ldk';
import { WhisperComponentType } from '@oliveai/ldk/dist/whisper/types';
export const selectWhisper = async () => {
await whisper.create({
label: 'Select',
components: [
{
type: WhisperComponentType.Select,
excludeDefaultOption: false,
label: 'Select Label',
options: [
'Option One',
'Option Two',
'Option Three',
],
selected: 0,
onSelect: (error, value) => {
console.log('Selected: ', value);
},
validationError: '',
},
],
});
}
import { React, ReactWhisper} from '@oliveai/ldk';
const TestSelect = () => {
const [selectValue, setSelectValue] = React.useState(0);
return (
<oh-whisper label="Select" onClose={() => {}}>
<oh-select
label="Select Label"
excludeDefaultOption={false}
onSelect={(error, value) => setSelectValue(value)}
options={[
'Option One',
'Option Two',
'Option Three',
]}
selected={selectValue}
tooltip="Select Tooltip"
validationError=""
/>
</oh-whisper>
);
};
ReactWhisper.renderNewWhisper(<TestSelect />);
Last updated