Permalink
Browse files

feat(dropdown): add toggleClass prop (#1485)

  • Loading branch information...
jpkleemans authored and pi0 committed Jan 23, 2018
1 parent 7967018 commit da16cc0cc10df339550f2fdeb48b85919b78536d
Showing with 15 additions and 4 deletions.
  1. +1 −0 src/components/dropdown/README.md
  2. +14 −4 src/components/dropdown/dropdown.js
@@ -244,6 +244,7 @@ by setting the prop `variant` to `success`, `primary`, `info`, `danger`, `link`
See the [Variant Reference](/docs/reference/variants) for a list of supported contextual variants.
You can also apply abritrary classes to the toggle button via the `toggle-class` prop. This prop accepts either a string or array of strings.
## Hidden Caret
The dropdown can be created with the caret hidden by setting the `no-caret` prop to `true`.
@@ -31,10 +31,7 @@ export default {
'b-button',
{
ref: 'toggle',
class: {
'dropdown-toggle': !t.noCaret || t.split,
'dropdown-toggle-split': t.split
},
class: t.toggleClasses,
props: {
variant: t.variant,
size: t.size,
@@ -94,6 +91,10 @@ export default {
type: String,
default: null
},
toggleClass: {
type: [String, Array],
default: null
},
noCaret: {
type: Boolean,
default: false
@@ -133,6 +134,15 @@ export default {
this.right ? 'dropdown-menu-right' : '',
this.visible ? 'show' : ''
]
},
toggleClasses () {
return [
{
'dropdown-toggle': !this.noCaret || this.split,
'dropdown-toggle-split': this.split
},
this.toggleClass
]
}
}
}

0 comments on commit da16cc0

Please sign in to comment.