Collapse
Variables
| CSS Variable | Default Value |
|---|---|
--va-collapse-font-size |
var(--va-font-size-1) |
--va-collapse-padding |
var(--va-space-3) |
--va-collapse-border-width |
var(--va-border-width) |
--va-collapse-border-color |
var(--va-border-color) |
--va-collapse-background-color |
var(--va-background-color-default) |
--va-collapse-tree-indentation |
var(--va-space-8) |
--va-collapse-icon-color |
var(--va-icon-color) |
Default
The purpose of thought
We can attain wisdom by three ways: first, by way of experience, this is the most difficult way; second, by way of imitation, this is the easiest way; and third by way of meditation, and this is the noblest way.
Confucius
<details class="va-collapse w-full">
<summary>
<strong>The purpose of thought</strong>
</summary>
<p>
We can attain wisdom by three ways: first, by way of experience, this is the most difficult way; second, by way of imitation, this is the easiest way; and third by way of meditation, and this is the noblest way.
</p>
<p>Confucius</p>
</details>Current
Use aria-current on the summary to highlight the current section, for example in a navigation tree.
Current section
Content of the current section.
<details class="va-collapse w-full">
<summary aria-current="true">Current section</summary>
<p>Content of the current section.</p>
</details>Nested
Thought
The purpose of thought
1
It often happens that a thought comes to us that seems both true and strange, and we hesitate to believe it. But then, if you think about it thoroughly, you see that the thought that seemed strange is the simplest truth, such that once you come to know it, you cannot stop believing in it.
2
While living among people, do not forget what you learned in solitude. And in solitude, reflect on what you learned from interacting with people.
<details class="va-collapse w-full">
<summary>
<strong>Thought</strong>
</summary>
<details class="va-collapse">
<summary>
<strong>The purpose of thought</strong>
</summary>
<label>
<span>Label</span>
<select class="va-select">
<option disabled selected>
Choose an option π
</option>
<option value="one">π</option>
<option value="two">π</option>
<option value="three">π</option>
</select>
</label>
<details class="va-collapse">
<summary>
<strong>1</strong>
</summary>
<p>It often happens that a thought comes to us that seems both true and strange, and we hesitate to believe it. But then, if you think about it thoroughly, you see that the thought that seemed strange is the simplest truth, such that once you come to know it, you cannot stop believing in it.</p>
</details>
<details class="va-collapse">
<summary>
<strong>2</strong>
</summary>
<p>
While living among people, do not forget what you learned in solitude. And in solitude, reflect on what you learned from interacting with people.
</p>
</details>
<button class="va-button">Buttons can also be nested</button>
<label>
<span>And checkboxes as well π</span>
<input class="va-checkbox" type="checkbox" />
</label>
</details>
</details>Indentation
Nested collapses are indented by the number of collapses they are inside, up to 6 levels. Wrapper elements in between donβt add indentation.
Components placed directly inside a collapse are indented to match its nesting level while keeping their borders full width: buttons, checkboxes, inputs and selects indent their own content, and cards, tables and button groups indent their inner parts. Your own components can do the same by reading the --va-inset-start custom property:
.my-item {
padding-left: var(--va-inset-start, 1rem);
}With other content
The purpose of thought
Timeless Literature
Our platform leverages a powerful API to bring you an extensive collection...
<details class="va-collapse w-full">
<summary>
<strong>The purpose of thought</strong>
</summary>
<div class="va-card w-full">
<div class="va-card__body">
<h2 class="va-card__title">Timeless Literature</h2>
<p>Our platform leverages a powerful API to bring you an extensive collection...</p>
</div>
<div class="va-card__actions text-right">
<button class="va-button">Start</button>
</div>
</div>
</details>