A stack of disclosures, from native <details> elements: the browser handles the keyboard, find-in-page, and links into a closed section. Pass each section as a <details> with a <summary> in the default slot. Give them one name to keep only one open at a time. A section slides open where the browser can animate to an intrinsic size, unless motion is reduced; elsewhere it opens at once.
<norn-accordion>
a container, from
@allons-y/webc-patterns
<norn-accordion>
<details name="faq" open>
<summary>Is it free to use?</summary>
<p>Yes. The project is open source under the MPL-2.0 license.</p>
</details>
<details name="faq">
<summary>Which Node version does it need?</summary>
<p>Node 24 or later.</p>
</details>
<details name="faq">
<summary>Where are bugs reported?</summary>
<p>In the issue tracker on GitHub.</p>
</details>
</norn-accordion>
Copy {name} to clipboardCopyCopiedCopy failedhtml code
Slots
Name
Description
default
The sections, each a <details>.
Tokens
The global tokens from tokens.json the component reads. Set one in a project's tokens.css to change it everywhere.
Type a value to try it in every example above. Reset puts the default back.
Token
Type
Default
Override
--norn-ui-accentThe brand color, shared by every component.
<color>
#2346d4
--norn-ui-border-colorHairline color.
<color>
light-dark(#d3d8e2, #2d323e)
--norn-ui-radius-sCorner radius of a part inside a component, and of inline code. A component's own radius is ui.border.radius.
<length>
4px
--norn-ui-focus-offsetGap between an element and its focus ring. An element the ring would clip draws it inset, at the negative of this.
<length>
2px
--norn-ui-state-hoverShare of the text color mixed into the background while the pointer is over a control.
<percentage>
8%
--norn-ui-state-pressShare of the text color mixed into the background while a control is pressed, and of the accent on a selected or current item.
<percentage>
12%
--norn-ui-motion-durationLength of a state change, such as a hover layer.
<time>
150ms
--norn-ui-motion-easingEasing for every transition.
<easing-function>
cubic-bezier(0.2, 0, 0, 1)
--norn-ui-control-heightHeight of a button, field, or tab. A component raises it to 2.75rem for a coarse pointer.
<length>
2.25rem
--norn-text-accentThe accent for text and links: darkened in light mode, lightened in dark mode. The lightness caps keep any accent at 4.5:1 or better.