Select

A Select component allows users to choose from a dropdown list. Built on top of heroui-native Select.

Demo

Demo Coming Soon

Select examples will be available soon.

Usage

import { useState } from 'react';
import { NSelect } from '@nayan-ui/react';
const items = [
{ value: 'startup', label: 'Startup' },
{ value: 'business', label: 'Business' },
{ value: 'enterprise', label: 'Enterprise' }
];
const Select = () => {
const [selected, setSelected] = useState(items[0]);
return (
<NSelect
isMulti={true}
isCreatable={true}
placeholder="Select something..."
isClearable={true}
isSearchable={true}
isDisabled={false}
value={selected}
options={items}
onCreateOptions={value => console.log(value)}
onChangeOptions={values => setSelected(values)}
/>
);
};
export default Select;

Attributes

NameTypeDefaultDetails
itemsSelectOption[]RequiredArray of select options with label and value.
onValueChange(value: string) => voidRequiredCallback when selection changes (returns the value string).
labelstringOptionalLabel above the select.
selectLabelstringOptionalLabel shown inside the dropdown list.
placeholderstringOptionalPlaceholder text for the select trigger.
defaultValueSelectOptionOptionalDefault selected option.
isDisabledbooleanfalseWhether the select is disabled.
containerClassNamestring' 'You can customise container by passing tailwind classes.
labelClassNamestring' 'You can customise label by passing tailwind classes.
triggerClassNamestring' 'You can customise trigger by passing tailwind classes.