# Toggle > `v-b-toggle` is a light-weight directive for toggling the visibility of collapses and sidebars, > and includes automated [WAI-ARIA accessibility](/docs/reference/accessibility) attribute handling. ## Overview The `v-b-toggle` directive can be used on interactive elements, such as buttons, to toggle the visibility state of the [``](/docs/components/collapse) and [``](/docs/components/sidebar) components. Besides toggling the visibility of the target component, the directive automatically updates ARIA accessibility attributes on the element it is applied to so that they reflect the visibility state of the target component. Refer to the [Accessibility section](#accessibility) below for additional details and caveats. ## Directive syntax and usage The directive is applied to the element or component that triggers the visibility of the target. The target component can be specified (via its ID) as either a directive modifier(s), the directive argument, or as a string/array passed to as the directive value: - `v-b-toggle.my-collapse` - the directive modifier (multiple targets allowed, each modifier is a target ID) - `v-b-toggle:my-collapse` - the directive argument ([Vue dynamic argument](https://vuejs.org/v2/guide/syntax.html#Dynamic-Arguments) is supported) v2.14.0+ - `v-b-toggle="'my-collapse'"` - the directive value as a string ID - `v-b-toggle="'my-collapse1 my-collapse2'"` - the directive value as a space separated string of IDs v2.14.0+ - `v-b-toggle="['my-collapse1', 'my-collapse2']"` - the directive value as an array of string IDs v2.14.0+ Modifiers, argument, and the value can be used at the same time when targeting multiple components. **Example usage:** ```html ``` ## Usage on links 2.15.0+ If placing the directive on a link (or a component that renders a link), the target ID can alternatively be specified via the `href` attribute. Note that the browser URL will change and the page may scroll the target into view. To prevent the URL from changing and the page from scrolling, add `@click.prevent` to the link. **Example usage:** ```html ``` ## Hiding and showing content in the toggle trigger element When using the `v-b-toggle` directive, the class `collapsed` will automatically be placed on the trigger element when the target component is closed, and removed when open. As of BootstrapVue `2.14.0`, the class `not-collapsed` will be applied when the target is _not_ closed. **Example HTML markup:** ```html
CloseOpen My Collapse
``` **Example Custom CSS:** ```css .collapsed > .when-open, .not-collapsed > .when-closed { display: none; } ``` ## Preventing the target from opening or closing To prevent the trigger element from toggling the target, set the `disabled` prop on `