Use for grouping related content with a header and optional collapse.
Custom content can be injected into the section header using a named slot. The slot:
label property is used.slot="q2-section-header" as an attribute to an item yielded within the element.h2 is recommended here to maintain parity with standard sectionsSection content
<q2-section>
<h2 slot="q2-section-header">
<q2-editable-field
value="Custom header content"
></q2-editable-field>
</h2>
<p>Section content</p>
</q2-section>
The q2-section element has one slot that can be used to insert custom content into the component.
An optional slot to display a custom header.
collapsibleDetermines if the section is collapsible.
expandedIndicates if the q2-section is in an expanded state or not.
labelThe text to display above the q2-section. Renders as an <h2> element.
It is also used to provided an aria-label for the toggle button when the component is collapsible.
If you are providing a custom header, setting this property is still strongly encouraged for the purposes of accessibility.
noCollapseIconno-collapse-iconDetermines if the collapse chevron icon should show in the q2-section header.
The q2-section element exposes events that can be used to send and receive data from the component based on user interaction.
Emitted when the section is expanded or collapsed.
{ expanded: boolean; }If an event handler is bound to the element using:
ontctChange property - The default handler will not fire, and the value must be updated in the custom handler.addEventListener("tctChange") method - The default handler will fire alongside the custom handler.The q2-section element exposes methods that can be used to perform various actions on the component.
A test method to collapse section.
collapse() => Promise<void>A test method to expand section.
expand() => Promise<void>Provide clean examples of how to compose multiple components together in order to achieve a specific visual outcome that is curated and maintained by Tecton.
How to build an Account Settings page in Tecton: six independent settings sections covering nickname, notifications, statement delivery, card management, spending limits, and overdraft protection.
The following CSS variables are available to override the default theme styles of the q2-section component.
Many Tecton components consume other components to maintain visual and functional consistency. If you are looking for a CSS variable you think should exist but are not seeing it, it may be defined in one of the dependent components below. Either way, if you think it's something we should expose more conveniently, let us know!
The changelog provides a detailed history of new features, improvements, and bug fixes going back to Tecton 1.30.0. If the button is disabled, it indicates there have been no detectable changes since then.