Collapse

Organize long explanations into collapsible topics so users can find what they need.

Live preview
Interact with the component to see results here.
View code
HTML
<sy-collapse id="sample">
  <sy-collapse-panel active arrow><span slot="header">Installation steps</span>
    <p>Install the package, then register the components you need.</p>
  </sy-collapse-panel>
  <sy-collapse-panel arrow><span slot="header">Change theme</span>
    <p>Apply the theme class to a shared container.</p>
  </sy-collapse-panel>
  <sy-collapse-panel arrow><span slot="header">Updates</span>
    <p>Review the release notes and update the version.</p>
  </sy-collapse-panel>
</sy-collapse>

Usage guide

#

Use for content opened when needed, such as FAQs or supplementary settings.

Compare multiple sections

Use the default mode to keep several panels expanded together.

Focus on one section

Use accordion to expand one panel at a time.

Panel structure
Place sy-collapse-panel inside sy-collapse and put the title in the header slot. Set the initial state with active, arrow visibility with arrow, and interaction availability with disabled. openPanel() and closePanel() use zero-based indices.

Feature examples

#

Choose a feature from 8 topics. Explore property settings, method calls, event results, and slot layouts through live examples and code.

Usage examples · Overview

Try the selected example. Topics with multiple configurations let you switch between detailed examples.

View code
HTML
Loading the example.

Usage examples · Overview

Try the selected example. Topics with multiple configurations let you switch between detailed examples.

View code
HTML
Loading the example.

Property · Accordion

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Borderless

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Disabled

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Full Height

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Property · Ghost

See how settings change appearance and behavior.

View code
HTML
Loading the example.

Methods · Open & Close

Use the example's buttons to call methods and inspect their results.

View code
HTML
Loading the example.

API reference

#

Hover over a name or focus it with the keyboard to see the code. On touch screens, tap the name.

<sy-collapse>

Properties

Attribute / PropertyTypeDefaultDescription
booleanfalseExpand only one panel at a time.
booleanfalseHide the default border.
booleanfalseBlock user interaction and keyboard focus.
booleanfalseUse a layout that fills the available height.
booleanfalseMinimize background and border styling.

Methods

MethodReturnsDescription
Promise<void>Expand all panels. In accordion mode, keep only one panel open.
Promise<void>Collapse all panels.
Promise<void>Expand the panel at the specified index.
Promise<void>Collapse the panel at the specified index.

Slots

SlotDescription
Component body or child items.

<sy-collapse-panel>

Properties

Attribute / PropertyTypeDefaultDescription
booleanfalseExpand the panel body.
booleanfalseShow the expansion arrow.
booleanfalseBlock user interaction and keyboard focus.
booleanfalseMinimize background and border styling.
booleanfalseFill the available height.

Events

EventDetailDescription
CustomEvent<CollapsePanelChangeDetail>Emitted when the value or selection state changes.

Methods

MethodReturnsDescription
Promise<void>Toggle the current expansion state.
Promise<void>Open the file chooser. Call within a user click handler.
Promise<void>Close the open panel.

Slots

SlotDescription
Content displayed in the header area.
Component body or child items.