Skip to content

Commit

Permalink
fix(dropdown-item-button): Add support for active state (#2212)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmllr95 authored and tmorehouse committed Nov 24, 2018
1 parent 7d768d1 commit 4b9e6c0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/dropdown/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ clicking (or pressing space or enter when focused), not by hovering; this is an
<b-dropdown-item>Second Action</b-dropdown-item>
<b-dropdown-item>Third Action</b-dropdown-item>
<b-dropdown-divider></b-dropdown-divider>
<b-dropdown-item>Something else here...</b-dropdown-item>
<b-dropdown-item active>Active action</b-dropdown-item>
<b-dropdown-item disabled>Disabled action</b-dropdown-item>
</b-dropdown>
</div>
Expand Down Expand Up @@ -58,7 +58,7 @@ Disabled the dropdown item button by setting the `disabled` prop.
<div>
<b-dropdown id="ddown-buttons" text="Dropdown using buttons as menu items" class="m-2">
<b-dropdown-item-button>I'm a button</b-dropdown-item-button>
<b-dropdown-item-button>I'm also a button</b-dropdown-item-button>
<b-dropdown-item-button active>I'm a active button</b-dropdown-item-button>
<b-dropdown-item-button disabled>I'm a button, but disabled!</b-dropdown-item-button>
<b-dropdown-item-button>I don't look like a button, but I am!</b-dropdown-item-button>
</b-dropdown>
Expand Down
9 changes: 9 additions & 0 deletions src/components/dropdown/dropdown-item-button.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import { mergeData } from 'vue-functional-data-merge'

export const props = {
active: {
type: Boolean,
default: false
},
activeClass: {
type: String,
default: 'active'
},
disabled: {
type: Boolean,
default: false
Expand All @@ -16,6 +24,7 @@ export default {
mergeData(data, {
props,
staticClass: 'dropdown-item',
class: { [props.activeClass]: props.active },
attrs: { role: 'menuitem', type: 'button', disabled: props.disabled },
on: {
click (e) {
Expand Down

0 comments on commit 4b9e6c0

Please sign in to comment.