Dropdown #

Dropdown is flexible form select component

import { PDropdown } from 'pearkit';

Basic #

Customsizable dropdown component with extra features.

Select Country
const [selected,setSelected] = useState({});
const countries = [
    {label: 'Country 1', value: 'co1'},
    {label: 'Country 2', value: 'co2'},
    {label: 'Country 3', value: 'co3'},
    {label: 'Country 4', value: 'co4'},
    {label: 'Country 5', value: 'co5'}
]
<PDropdown
    options={countries}
    selected={selected}
    onChange={setSelected}
    placeholder="Select Country"
/>

Colors #

Since we use the tailwind color palette in our design, you can use the names of all tailwind colors as props. For example : sky red indigo etc.

Select Country Yellow
Select Country Indigo
Select Country Cyan
<PDropdown color="yellow"/>

Disabled #

Disabled feature for custom dropdown component

Select Country
<PDropdown disabled={true}>

Accessibility (Not Ready Yet) #

None

Api #

Here you can see all the working features for the dropdown component.

NameTypeDefaultDescription
optionsarraynullOptions of the dropdown component
selectorstringlabelSelector of array object list
onChangefunctionnullOnChange callback function for setting data
selectedobject{}Controlled by parent state prop
placeholderstringSelect ItemPlaceholder of the dropdown component
itemComponentelementTypenullFor customsizable dropdown item component
colorstringblueWith this prop you can use all the names in the tailwindcss default color palette.