Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

update Dropdown to accept optionHeight prop #552

Merged
merged 2 commits into from
May 10, 2019
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

- `figure` prop in `dcc.Graph` now accepts a `frames` key
- Improved the `Dropdown` options description for dash-docs #547
- Added `optionHeight` prop to `Dropdown` #552

### Removed

Expand Down
7 changes: 4 additions & 3 deletions dash_core_components/Dropdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class Dropdown(Component):
multiple values can be selected at once, and `value` is an
array of items with values corresponding to those in the
`options` prop.
- optionHeight (number; optional): height of each option. Can be increased when label lengths would wrap around
- className (string; optional): className of the dropdown element
- clearable (boolean; optional): Whether or not the dropdown is "clearable", that is, whether or
not a small "x" appears on the right of the dropdown that removes
Expand All @@ -41,12 +42,12 @@ class Dropdown(Component):
- prop_name (string; optional): Holds which property is loading
- component_name (string; optional): Holds the name of the component that is loading"""
@_explicitize_args
def __init__(self, id=Component.UNDEFINED, options=Component.UNDEFINED, value=Component.UNDEFINED, className=Component.UNDEFINED, clearable=Component.UNDEFINED, disabled=Component.UNDEFINED, multi=Component.UNDEFINED, placeholder=Component.UNDEFINED, searchable=Component.UNDEFINED, style=Component.UNDEFINED, loading_state=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'options', 'value', 'className', 'clearable', 'disabled', 'multi', 'placeholder', 'searchable', 'style', 'loading_state']
def __init__(self, id=Component.UNDEFINED, options=Component.UNDEFINED, value=Component.UNDEFINED, optionHeight=Component.UNDEFINED, className=Component.UNDEFINED, clearable=Component.UNDEFINED, disabled=Component.UNDEFINED, multi=Component.UNDEFINED, placeholder=Component.UNDEFINED, searchable=Component.UNDEFINED, style=Component.UNDEFINED, loading_state=Component.UNDEFINED, **kwargs):
self._prop_names = ['id', 'options', 'value', 'optionHeight', 'className', 'clearable', 'disabled', 'multi', 'placeholder', 'searchable', 'style', 'loading_state']
self._type = 'Dropdown'
self._namespace = 'dash_core_components'
self._valid_wildcard_attributes = []
self.available_properties = ['id', 'options', 'value', 'className', 'clearable', 'disabled', 'multi', 'placeholder', 'searchable', 'style', 'loading_state']
self.available_properties = ['id', 'options', 'value', 'optionHeight', 'className', 'clearable', 'disabled', 'multi', 'placeholder', 'searchable', 'style', 'loading_state']
self.available_wildcard_properties = []

_explicit_args = kwargs.pop('_explicit_args')
Expand Down
2,716 changes: 1,361 additions & 1,355 deletions dash_core_components/dash_core_components.dev.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_core_components/dash_core_components.dev.js.map

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions dash_core_components/dash_core_components.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_core_components/dash_core_components.min.js.map

Large diffs are not rendered by default.

293 changes: 152 additions & 141 deletions dash_core_components/metadata.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions demo/Demo.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,11 @@ const properties = {
{'label': 'Melons', 'value': 'melons', 'disabled': false},
{'label': 'Apples', 'value': 'apples'},
{'label': 'Oranges', 'value': 'oranges', 'disabled': true}
]
],
optionHeight: 50
};

ReactDOM.render(<Dropdown {...properties}/>, mountNode);`
ReactDOM.render(<Dropdown {...properties} />, mountNode);`

const GraphExample = `const properties = {
animate: true,
Expand Down
2 changes: 1 addition & 1 deletion demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import LoadingDemo from './LoadingDemo.react';

ReactDOM.render(
<div>
<Tabs>
<Tabs value={'tab-2'}>
<Tab value="tab-1" label='Loading Demo'>
<LoadingDemo />
</Tab>
Expand Down
6 changes: 6 additions & 0 deletions src/components/Dropdown.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ Dropdown.propTypes = {
PropTypes.arrayOf(PropTypes.number),
]),

/**
* height of each option. Can be increased when label lengths would wrap around
*/
optionHeight: PropTypes.number,

/**
* className of the dropdown element
*/
Expand Down Expand Up @@ -223,4 +228,5 @@ Dropdown.defaultProps = {
disabled: false,
multi: false,
searchable: true,
optionHeight: 35,
};