react-dropdown-now
Simple Dropdown component for React.
requires React >= 16.8
Flat Array options
Object Array options
When using Object options you can add to each option:
- a
className
string to further customize the dropdown, e.g. adding icons to options - a
view
node to render an isolated view in the dropdown options list which is different from what could be seen in the dropdown control (selected value) - an
id
string can be used to give an id to each option. Must be unique; even when mixing grouped options with single options. Useful for whenoption.value
is not astring
ornumber
. Can be used with a custom matcher to determine the selected option.
Disabled
matcher
The default matcher will use the value prop to match against values within the options array.
custom matcher example:
Customizing
Classname | Targets |
---|---|
rdn |
main wrapper div |
rdn-control |
dropdown control |
rdn-control-arrow |
dropdown arrow indicator |
rdn-control-placeholder |
placeholder / selected item in dropdown control |
rdn-drop |
container for dropdown options |
Using custom arrows
arrowClosed, arrowOpen
The arrowClosed
& arrowOpen
props enable passing in custom elements for the open/closed state arrows.