
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
@asphalt-react/dropdown
Advanced tools
An accessible native select alternative that makes it easy to choose one or more options.
A dropdown mainly consists of 3 parts.
SelectionBox - holds the selected valueListBox - holds the optionsListItem - the option itselfYou would typically pass an array of options where each option is an object containing at least 2 properties, id & key.
let items = [{ id: "1", key: "Apple"}, { id: "2", key: "Banana" }, ...]
The id property is how Dropdown identifies & knows the item. Naturally, it should be unique. The key property's value will be shown as the list item, so users can easily identify the option they would like to choose.
Dropdown supports multiple selection and filtering on items. Can also be kept open initially and provides the ability to reset programmatically. You may also choose in which order selected items are rendered. This can be useful for cases where you want to retain & restore the original order of user selection.
import Dropdown from "@asphalt-react/dropdown"
function App() {
let items = [
{ id: "1", key: "Bangalore" },
{ id: "2", key: "Delhi" },
]
return <Dropdown items={items} />
}
Apply the multiSelect prop when you want your user to select more than one item.
To enable filtering with multiselect apply the typeahead prop.
For multiselect, use initialSelectedItems instead of initialSelectedItem.
By default ListBox opens up below the SelectionBox. ListBox flips in the opposite side if there is not enough space to render, it improves user experience on small screens.
To disable this behavior, set flip to false.
ListBox flipping doesn't work with multiSelect.
A ListItem can render an Avatar component or an image as a prefix. For example, showing avatars/initials for a list of users.
Internationalization is the process of designing and preparing your app to be usable in different languages.
SelectionBox text supports l10n and can be achieved using translate.
translate only works with the multiSelect.
The Dropdown component is completely keyboard friendly. It is engineered in such a way that the user never needs to move their hand to the mouse, if they so desire.
The Dropdown allows passing data-* attributes to the top level element of Dropdown. data-* are used by Dropdown to identify each of its instances and test its behavior. Dropdown's internal elements have a data-testid attribute which are used for testing purposes.
Array of Objects that dropdown renders
items = [{ id: "1", key: "jakarta", ...]
Complete shape of each object may look like:
{
id: "string-to-uniquely-identify-the-item",
key: "DisplayValue",
selected: false // true if this item should be selected
selectionOrder: 0 // a valid integer to specify the order
}
Out of the above only id is required. Typically, at the least, provide id
and key.
| type | required | default |
|---|---|---|
| arrayOf | true | N/A |
Hint text to show when no item is selected
| type | required | default |
|---|---|---|
| string | false | "Select" |
Called when selected item changes by user interaction or the Dropdown resets. It receives multiple arguments with the following signature
selectedItems key gives an array of selectedItems when multiSelect (item, options) => void
| type | required | default |
|---|---|---|
| func | false | N/A |
Callback to handle user input in a typeahead enabled Dropdown. It receives the React synthetic event as the argument.
(event) => {}
| type | required | default |
|---|---|---|
| func | false | N/A |
Renders the component with the provided size. accepts s, m, l for small, medium & large
| type | required | default |
|---|---|---|
| enum | false | "m" |
Stretches the component width to match its container
| type | required | default |
|---|---|---|
| bool | false | false |
This is the index value of an item which will be highlighted when Dropdown is initialized or reset
| type | required | default |
|---|---|---|
| number | false | 0 |
Item which should be pre-selected on initialization. Applies for the first render only.
Note: This prop is going to be deprecated in next major version
| type | required | default |
|---|---|---|
| object | false | N/A |
Items which should be pre-selected for multiSelect on initialization. Applies for the first render only.
Note: This prop is going to be deprecated in next major version
| type | required | default |
|---|---|---|
| arrayOf | false | [] |
Opens Dropdown on initialization
| type | required | default |
|---|---|---|
| bool | false | false |
z-index of list box
| type | required | default |
|---|---|---|
| number | false | 1 |
Disables the Dropdown
| type | required | default |
|---|---|---|
| bool | false | false |
Applies invalid styles to the Dropdown
| type | required | default |
|---|---|---|
| bool | false | N/A |
Key property name of the items, the key property's value will be shown as the list item
| type | required | default |
|---|---|---|
| string | false | "key" |
Dropdown flip according to viewport boundary
| type | required | default |
|---|---|---|
| bool | false | true |
Don't show unmatched typeahead items
When typeahead is applied, only the matching items will show up in the list.
Passing false will instead show all the unmatched items after the matched items
in the list. This way, you can control if all items are shown in the list or not.
As a consequence, if filter is false, then the empty state will never appear.
filter has no effect when typeahead={false}
| type | required | default |
|---|---|---|
| bool | false | true |
Enables multiple item selection
| type | required | default |
|---|---|---|
| bool | false | false |
Function to show custom text in selectionBox in multiSelect
| type | required | default |
|---|---|---|
| func | false | N/A |
DOM id of the Dropdown
| type | required | default |
|---|---|---|
| string | false | N/A |
Id of the label used for Dropdown. Used for aria attributes.
| type | required | default |
|---|---|---|
| string | false | N/A |
Custom reference for reset.
reset does not clear the Dropdown.
It resets the Dropdown to its first render.
Only works with initialSelectedItem or initialSelectedItems
Note: This prop is going to be deprecated in next major version
| type | required | default |
|---|---|---|
| union | false | N/A |
Enables filtering of matched items based on typed keywords. The matching algorithm used gives the end user the best possible user experience.
| type | required | default |
|---|---|---|
| bool | false | false |
Show custom text when no result is found
| type | required | default |
|---|---|---|
| string | false | "No Results Found." |
Shows the selected items as tags above a multiselect dropdown.
from v1.20.0+
| type | required | default |
|---|---|---|
| bool | false | true |
FAQs
Dropdown
We found that @asphalt-react/dropdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.