Reveal hidden content by transitioning from a set number of lines
to height: auto. Set the number of lines shown when
closed via --lines.
Standalone
<link rel="stylesheet" href="https://esm.sh/@erikt/ui/expander.css" />
Default
<div class="expander">
<p>Long content...</p>
<label>
<input type="checkbox" />
Show more
</label>
</div>
Lines
Control how many lines are shown when collapsed via
--lines. Defaults to 3.
<div class="expander" style="--lines: 6">
<p>Long content...</p>
<label>
<input type="checkbox" />
Show more
</label>
</div>
API reference
| Type | Classes / attributes | What it does |
|---|---|---|
| Lines | --lines: 3 |
Number of lines shown while collapsed |