Skip to content

feat: add toggle, an icon button that stays on or off - #109

Merged
zyx1121 merged 1 commit into
mainfrom
feat/toggle
Nov 12, 2026
Merged

zyx1121 merged 1 commit into
mainfrom
feat/toggle

Conversation

@zyx1121

@zyx1121 zyx1121 commented Nov 12, 2026

Copy link
Copy Markdown
Member

Why

Apps had no component for an on/off icon button, so meet swapped button variants by hand. The fill meant "on" for one control and "off" for the next, and the icon changed in one frame.

What

  • toggle (Base UI Toggle), the size of an icon button.
  • variant="default": a feature that starts off. On is the primary fill.
  • variant="alert": a device expected to be on (microphone, camera). Off is the destructive tint.
  • offIcon: the icon while off. The two icons share one cell and swap with a scale and fade at duration-state; reduced motion keeps the fade only.
  • DESIGN.md: the rule for stateful buttons.
  • Docs page /toggle.

Verified

Sandbox: theme:check, tokens:check, lint, typecheck, format:check, build pass. Headless Chromium on the built /toggle page, light and dark: aria-pressed and the fill flip on click, and the icon opacities cross over in about 150 ms.

🤖 Generated with Claude Code

Its state shows in the fill and, with offIcon, in the icon, which swaps
with a short scale and fade. variant alert is for devices expected to be
on: off is the destructive tint.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@zyx1121
zyx1121 merged commit 043bcbb into main Nov 12, 2026
4 checks passed
@zyx1121
zyx1121 deleted the feat/toggle branch November 12, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant