Skip to content

Commit 4b9e6c0

Browse files
jacobmllr95tmorehouse
authored andcommitted
fix(dropdown-item-button): Add support for active state (#2212)
1 parent 7d768d1 commit 4b9e6c0

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/components/dropdown/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ clicking (or pressing space or enter when focused), not by hovering; this is an
1515
<b-dropdown-item>Second Action</b-dropdown-item>
1616
<b-dropdown-item>Third Action</b-dropdown-item>
1717
<b-dropdown-divider></b-dropdown-divider>
18-
<b-dropdown-item>Something else here...</b-dropdown-item>
18+
<b-dropdown-item active>Active action</b-dropdown-item>
1919
<b-dropdown-item disabled>Disabled action</b-dropdown-item>
2020
</b-dropdown>
2121
</div>
@@ -58,7 +58,7 @@ Disabled the dropdown item button by setting the `disabled` prop.
5858
<div>
5959
<b-dropdown id="ddown-buttons" text="Dropdown using buttons as menu items" class="m-2">
6060
<b-dropdown-item-button>I'm a button</b-dropdown-item-button>
61-
<b-dropdown-item-button>I'm also a button</b-dropdown-item-button>
61+
<b-dropdown-item-button active>I'm a active button</b-dropdown-item-button>
6262
<b-dropdown-item-button disabled>I'm a button, but disabled!</b-dropdown-item-button>
6363
<b-dropdown-item-button>I don't look like a button, but I am!</b-dropdown-item-button>
6464
</b-dropdown>

src/components/dropdown/dropdown-item-button.js

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import { mergeData } from 'vue-functional-data-merge'
22

33
export const props = {
4+
active: {
5+
type: Boolean,
6+
default: false
7+
},
8+
activeClass: {
9+
type: String,
10+
default: 'active'
11+
},
412
disabled: {
513
type: Boolean,
614
default: false
@@ -16,6 +24,7 @@ export default {
1624
mergeData(data, {
1725
props,
1826
staticClass: 'dropdown-item',
27+
class: { [props.activeClass]: props.active },
1928
attrs: { role: 'menuitem', type: 'button', disabled: props.disabled },
2029
on: {
2130
click (e) {

0 commit comments

Comments
 (0)