Skip to content

Collapse

The Collapse component is an easy way to toggle the visibility of content with show/hide functionality. The component supports the W3C ARIA APG Accordion Pattern.

Examples

Base

A custom trigger can be passed in the trigger slot.

Accessibility Note:

The trigger container is already an interactive element with the role="button" attribute. For accessibility reasons, prevent adding other interactive elements such as buttons to avoid nested-interactive accessibility problems.

Accordion

Combine multiple collapse components to create an accordion behaviour.

Collapse component

An easy way to toggle what you want.

html
<o-collapse></o-collapse>

Props

Prop nameDescriptionTypeValuesDefault
animationCustom animation (transition name)string-
From config:
collapse: {
  animation: "fade"
}
contentIdId property of the content container - default is an uuidstring-useId()
expandedExpand the trigger to fullwidthboolean-false
openWhether collapse is open or not, use v-model:open to make it two-way bindingboolean-true
overrideOverride existing theme classes completelyboolean-
positionTrigger position"bottom" | "top"top, bottom
From config:
collapse: {
  position: "top"
}
triggerIdId property of the trigger container - default is an uuidstring-useId()

Events

Event namePropertiesDescription
update:openvalue boolean - updated open propopen prop two-way binding
openon collapse opened
closeon collapse closed

Slots

NameDescriptionBindings
triggerDefine the collapse triggeropen boolean - collapse open state
defaultDefault content

Class Inspector

Classes applied to the element:
Class propDescriptionPropsSuffixes
rootClassClass of the root element.
positionClassClass of the root element with position.position
triggerClassClass of the trigger element.
expandedClassClass of the trigger element when expanded.expanded
contentClassClass of the content element.

Sass variables

Current theme ➜ Oruga

SASS VariableDefault

See ➜ 📄 Full scss file

Current theme ➜ Bulma

The theme does not have any custom variables for this component.

Current theme ➜ Bootstrap

The theme does not have any custom variables for this component.

Released under the MIT License.