diff --git a/src/components/navbar/README.md b/src/components/navbar/README.md index c7b3e279bc7..b885b64295b 100755 --- a/src/components/navbar/README.md +++ b/src/components/navbar/README.md @@ -272,10 +272,12 @@ Use the `` component to control the collapse component, and set Set the `toggleable` prop on `` to the desired breakpoint you would like content to automatically collapse at. Possible `toggleable`values are `sm`, `md`, and `lg`. Setting -`togleable` to `true` (or with no explicit value) will set the breakpoint to `sm`, while +`toggleable` to `true` (or with no explicit value) will set the breakpoint to `sm`, while setting it to `false` will disable collapsing. -`` should be placed _before_ any `` component. +`` components are left-aligned by default, but should they follow a sibling +element like ``, they’ll automatically be aligned to the far right. Reversing +your markup will reverse the placement of the toggler. See the first example on this page for reference, and also refer to [``](/docs/components/collapse) for details on the collapse component. diff --git a/src/components/navbar/navbar-toggle.js b/src/components/navbar/navbar-toggle.js index 4302e7ffa53..e8be132f376 100644 --- a/src/components/navbar/navbar-toggle.js +++ b/src/components/navbar/navbar-toggle.js @@ -1,3 +1,50 @@ -import bNavbarToggle from './navbar-toggle.vue'; +import { listenOnRootMixin } from '../../mixins'; -export default bNavbarToggle; +export default { + mixins: [listenOnRootMixin], + render(h) { + const t = this; + return h( + 'button', + { + class: [ 'navbar-toggler' ], + attrs: { + type: 'button', + 'aria-label': t.label, + 'aria-controls': t.target, + 'aria-expanded': t.toggleState ? 'true' : 'false' + }, + on: { click: t.onClick } + }, + [ t.$slots.default || h('span', { class: [ 'navbar-toggler-icon' ] }) ] + ); + }, + data() { + return { + toggleState: false + }; + }, + props: { + label: { + type: String, + default: 'Toggle navigation' + }, + target: { + type: String, + required: true + } + }, + methods: { + onClick() { + this.$root.$emit('bv::toggle::collapse', this.target); + }, + handleStateEvt(id, state) { + if (id === this.target) { + this.toggleState = state; + } + } + }, + created() { + this.listenOnRoot('bv::collapse::state', this.handleStateEvt); + } +}; diff --git a/src/components/navbar/navbar-toggle.vue b/src/components/navbar/navbar-toggle.vue deleted file mode 100755 index 4e62ece9262..00000000000 --- a/src/components/navbar/navbar-toggle.vue +++ /dev/null @@ -1,59 +0,0 @@ - - -