Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

tags
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,21 @@ const locations = [
];
```

Optionally, the object can contain the "disabled" key to disable the item
```javascript
const locations = [
{
label: 'New York',
value: 'newYork',
},
{
label: 'Oslo',
value: 'oslo',
disabled: true,
},
];
```

Use a function to pass to `onChange` prop.
For `<Dropdown>` component item is an object, whereas for `<DropdownMultiple>` it is an array of objects.

Expand Down
50 changes: 41 additions & 9 deletions example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reactjs-dropdown-component",
"version": "1.2.0",
"version": "1.3.0",
"description": "Single and multi select dropwdown menu components",
"main": "build/index.js",
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion src/Dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,15 @@ class Dropdown extends Component {
tempList.map((item) => (
<button
type="button"
className={`dd-list-item ${id}`}
className={
`dd-list-item ${id} ${
item.disabled ? 'dd-list-item--disabled' : ''
}`
}
style={listItem}
key={item.value}
onClick={() => this.selectItem(item)}
disabled={item.disabled || false}
>
{item.label}
{' '}
Expand Down