# 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.

Source

# 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 cusomize the output HTML classes:

:classes="{ root: 'root-class', label: 'label-class', content: 'content-class' }"
Last Updated: 4/15/2020, 12:16:00 AM