# Toggle

Toggle the visibility of content. Useful for something like an FAQ page, for example. Includes ARIA attributes for expandable content and is keyboard friendly.

# Installation

Globally:

// main.js
import Vue from 'vue';
import { VToggle } from 'vuetensils/src/components';

Vue.component('VToggle', VToggle);

Locally:

<script>
// SomeComponent.vue
import { VToggle } from 'vuetensils/src/components';

export default {
  components: {
    VToggle,
  },
  // ...
};
</script>

# Styled Example

.vts-toggle__button {
  display: block;
  width: 100%;
  border: 0;
  padding: 5px;
  font-size: 18px;
  text-align: left;
  color: #FFF;
  background-color: mediumseagreen;
}

.toggle-content {
  border: 1px solid #CCC;
  padding: 5px;
}

# Basic Usage

# Label Slot

Sometimes just a text string won't do. For example, you may want to add icons or something.

# Scoped Slots

You can access the open status through the scoped slots.

# Events

  • update: fires on any change and provides the open status
  • open: fires on open.
  • close: fires on close.

# Custom Classes

This component can accept a classes prop to customize the output HTML classes:

:classes="{ root: 'root-class', label: 'label-class', content: 'content-class' }"
Last Updated: 10/17/2020, 2:28:03 PM