Repository navigation
feat: add toggle, an icon button that stays on or off - #109
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 atduration-state; reduced motion keeps the fade only./toggle.Verified
Sandbox:
theme:check,tokens:check,lint,typecheck,format:check,buildpass. Headless Chromium on the built/togglepage, light and dark:aria-pressedand the fill flip on click, and the icon opacities cross over in about 150 ms.🤖 Generated with Claude Code