Kwark. Design System
Open Kwark

Icon toggle

A pair of glyph buttons that switch a view, such as poster or list on Home. Pressed is a filled square; each says its name.

ComponentsSelectionIn the app
<div class="kw-icontoggle" role="group" aria-label="Library view">
  <button type="button" aria-label="Poster view" aria-pressed="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/></svg></button>
  <button type="button" aria-label="List view" aria-pressed="false"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12h.01M3 18h.01M3 6h.01M8 12h13M8 18h13M8 6h13"/></svg></button>
</div>

What it is

The view switch at the end of Home’s toolbar (.home-view): Poster view and List view, 30px squares, the pressed one filled in --k-raise, set off from the filters by a 1px rule.

When to use

  • Two or three views of the same items, where the glyphs are universal (grid, list).

When not to use

Writing

Each button is named Poster view, List view: the view, not the glyph.

Anatomy

  1. Group: 2px gap, 12px left padding, 1px --k-line on the left.
  2. Button: 30 × 30px (44px on touch), 4px corners, no border, --k-text-2, glyph 16px.
  3. Pressed: --k-raise background, --k-text.

Tokens

Token Light Dark
--k-raise #f1f5f9 #252525
--k-line #e2e8f0 rgba(255, 255, 255, .1)
--k-text #0f172a #e3e3e3
--k-text-2 #5b6779 #9ca3af
--k-icon-md 16px

React

Use the HTML below with kwark.css. The example shows the markup and styling. Supply any application behavior described on this page.

HTML and CSS

Works anywhere with kwark.css.

<div class="kw-icontoggle" role="group" aria-label="Library view">
  <button type="button" aria-label="Poster view" aria-pressed="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="3" y="3" width="7" height="7" rx="1"/><rect x="14" y="3" width="7" height="7" rx="1"/><rect x="14" y="14" width="7" height="7" rx="1"/><rect x="3" y="14" width="7" height="7" rx="1"/></svg></button>
  <button type="button" aria-label="List view" aria-pressed="false"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 12h.01M3 18h.01M3 6h.01M8 12h13M8 18h13M8 6h13"/></svg></button>
</div>

Keyboard

Key Does
Tab Each button.
Enter / Space Switches to that view.

ARIA

  • role="group" with a name; buttons with aria-label and aria-pressed, and a title with the same name for pointer users.

Rules

  • Must name each toggle by the view it shows.
  • Never use icon toggles for glyphs that are not universal.
  • Always grow to 44px under a thumb.

AI readiness test

Task. Add a “board / table” switch to the Breakdown.

Give the agent. This page, the Segmented control page.

Constraint. The board glyph is not universal.

A reliable answer

  • Uses a Segmented control with words, or names the toggles “Board view” and “Table view”
  • Keeps aria-pressed
  • Grows to 44px on phones

Give this Markdown to your coding agent or share its URL.

Open .mdllms.txt
Loading…