Skip to content

Commit 7700ab0

Browse files
Move className back to dropdown li tag
Adds actual docs to `options` prop with a sample array.
1 parent 8f1b35e commit 7700ab0

File tree

3 files changed

+51
-5
lines changed

3 files changed

+51
-5
lines changed

components/menu-dropdown/menu-dropdown.jsx

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,31 @@ const MenuDropdown = React.createClass({
255255
*/
256256
onClose: PropTypes.func,
257257
/**
258-
* An array of menu item.
258+
* An array of menu item objects. `className` and `id` object keys are applied to the `li` DOM node. `divider` key can have a value of `top` or `bottom`. `rightIcon` and `leftIcon` are not actually `Icon` components, but prop objects that get passed to an `Icon` component. The `href` key will be added to the `a` and its default click event will be prevented. Here is a sample:
259+
* ```
260+
* [{
261+
* className: 'custom-li-class',
262+
* divider: 'bottom',
263+
* label: 'A Header',
264+
* type: 'header'
265+
* }, {
266+
* href: 'http://sfdc.co/',
267+
* id: 'custom-li-id',
268+
* label: 'Has a value',
269+
* leftIcon: {
270+
* name: 'settings',
271+
* category: 'utility'
272+
* },
273+
* rightIcon: {
274+
* name: 'settings',
275+
* category: 'utility'
276+
* },
277+
* type: 'item',
278+
* value: 'B0'
279+
* }, {
280+
* type: 'divider'
281+
* }]
282+
* ```
259283
*/
260284
options: PropTypes.array,
261285
/**

components/menu-list/list-item.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,15 @@ const ListItem = React.createClass({
167167
return (
168168
<li
169169
aria-selected={this.props.isSelected}
170-
className={classNames('slds-dropdown__item', { 'slds-is-selected': this.props.isSelected })}
170+
className={classNames('slds-dropdown__item', {
171+
'slds-is-selected': this.props.isSelected
172+
},
173+
this.props.className)}
171174
id={this.props.id}
172175
onMouseDown={this.handleMouseDown}
173176
role="presentation"
174177
>
175178
<a
176-
className={this.props.className}
177179
href={this.props.href}
178180
ref="link"
179181
data-index={this.props.index}

stories/dropdown/index.jsx

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,30 @@ import Button from '../../components/button';
1212
import Trigger from '../../components/menu-dropdown/button-trigger';
1313

1414
const options = [
15-
{ label: 'A Header', divider: 'bottom', className: 'custom-header-class', type: 'header' },
15+
{ className: 'custom-li-class',
16+
divider: 'bottom',
17+
label: 'A Header',
18+
type: 'header'
19+
},
1620
{ label: 'An option that is Super Super Long', value: 'A0' },
1721
{ label: 'Custom Class', className: 'custom-item-class', value: 'classssss' },
18-
{ label: 'Another option', value: 'B0' },
22+
{
23+
href: 'http://sfdc.co/',
24+
id: 'custom-li-id',
25+
label: 'Has a value',
26+
leftIcon: {
27+
name: 'settings',
28+
category: 'utility'
29+
},
30+
rightIcon: {
31+
name: 'settings',
32+
category: 'utility'
33+
},
34+
type: 'item',
35+
value: 'B0'
36+
}, {
37+
type: 'divider'
38+
},
1939
{ label: 'C Option', value: 'C0' },
2040
{ label: 'D Option', value: 'D0' },
2141
{ label: 'E Option', value: 'E0' },

0 commit comments

Comments
 (0)