Skip to main content

Multi select

Props

NameTypeDefaultDescription
optionsarray[]List of options for the select/dropdown input. Each option should have a label and value.
namestring-Selects's name being registered field.
isDisabledboolean-Disables the input field when true.
idstring''The unique identifier for the select field.
labelstring''The label for the select field.
tooltipstring or ReactNode-Tooltip content to display additional information about the field.
fetchUrlstring''URL to fetch dynamic options for the select.
transformOptionsfunction() => [{ label: '', value: '' }]Function to transform fetched data into a compatible options array.

Multiselect with static options

const countrySelectConfig = {
type: 'multiselect',
data: {
id: 'skills',
name: 'skills',
label: 'Select Your Skills *',
tooltip: 'Choose the skills relevant to the job you are applying for.',
options: [
{ label: 'JavaScript', value: 'javascript' },
{ label: 'Python', value: 'python' },
{ label: 'React.js', value: 'react' }
],
placeholder: 'Select your skills'
}
}

Multiselect with dynamic options

const dynamicSelectConfig = {
type: 'multiselect',
data: {
id: 'countries',
name: 'countries',
label: 'Select Countries *',
tooltip: 'Choose one or more countries.',
fetchUrl: 'https://restcountries.com/v3.1/all', // Public API to fetch countries
transformOptions: (options) => {
return options.map((country: { name: { common: string } }) => ({
label: country.name.common,
value: country.name.common.toLowerCase()
}))
},
placeholder: 'Select countries'
}
}