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.
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' }"