Skip to content

Commit

Permalink
Fixed #1019 - added className support to SelectButtonItems
Browse files Browse the repository at this point in the history
  • Loading branch information
mertsincan committed Oct 14, 2019
1 parent 8975694 commit 5dd084d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/selectbutton/SelectButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export class SelectButton extends Component {
return this.props.options.map((option, index) => {
let optionLabel = this.getOptionLabel(option);

return <SelectButtonItem key={optionLabel} label={optionLabel} option={option} onClick={this.onOptionClick}
return <SelectButtonItem key={optionLabel} label={optionLabel} className={option.className} option={option} onClick={this.onOptionClick}
selected={this.isSelected(option)} tabIndex={this.props.tabIndex} disabled={this.props.disabled} />;
});
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/selectbutton/SelectButtonItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export class SelectButtonItem extends Component {
static defaultProps = {
option: null,
label: null,
className: null,
selected: null,
tabIndex: null,
onClick: null
Expand All @@ -15,6 +16,7 @@ export class SelectButtonItem extends Component {
static propTypes = {
option: PropTypes.object,
label: PropTypes.string,
className: PropTypes.string,
selected: PropTypes.bool,
tabIndex: PropTypes.number,
onClick: PropTypes.func
Expand Down Expand Up @@ -60,7 +62,7 @@ export class SelectButtonItem extends Component {
}

render() {
let className = classNames('p-button p-component p-button-text-only', {
let className = classNames('p-button p-component p-button-text-only', this.props.className, {
'p-highlight': this.props.selected,
'p-disabled': this.props.disabled,
'p-focus': this.state.focused
Expand Down

0 comments on commit 5dd084d

Please sign in to comment.