feat(switch): add xs extra-small size variant#427
Open
awhobbs87 wants to merge 2 commits intocloudflare:mainfrom
Open
feat(switch): add xs extra-small size variant#427awhobbs87 wants to merge 2 commits intocloudflare:mainfrom
awhobbs87 wants to merge 2 commits intocloudflare:mainfrom
Conversation
Add a new size="xs" option (14x28px track, 14px thumb) for use in inline badges, pills, and compact toolbars where the existing sm size is too large. Size progression: xs (14px) < sm (16px) < base (18px) < lg (20px). - KUMO_SWITCH_VARIANTS: add xs entry with classes and description - sizeStyles: add xs track/thumb/slide in both SwitchBase and SwitchItem - SwitchSizesDemo: add xs example - switch.mdx: update sizes documentation
commit: |
Contributor
Docs PreviewCommit: |
Contributor
…x24px) The xs track renders at 14x28px which is below the 24px minimum height for touch targets. Add min-h-6 min-w-6 to the outer wrapper so the clickable area meets accessibility requirements while the visual track remains compact.
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.
















































Summary
Adds a new
size="xs"option to the Switch component for use in inline badges, pills, and compact toolbars where the existingsmsize is too large.Motivation
In an internal admin tool, we embed toggle switches inside compact sidebar pills (10px font, tight padding). The Kumo Switch
sm(16px track height) is too bulky for this context — it visually dominates the pill and causes wrapping at narrow sidebar widths. We initially built a custom micro-toggle matching Kumo's visual language (squircle corners, ring border, thumb shadow, blue/neutral palette) but would prefer to use the official component.Changes
KUMO_SWITCH_VARIANTS.size: Addedxsentry withh-4.5 w-7wrapper classessizeStyles(bothSwitchBaseandSwitchItem): Addedxswithh-3.5 w-7track,w-3.5thumb,left-3.5slide — following the existing progression where each step adds+0.5TW units to height/thumb and+1to widthSwitchSizesDemo: Addedxsexampleswitch.mdx: Updated sizes documentation to mention all four sizes@cloudflare/kumoSize progression
h-3.5 w-7w-3.5h-4 w-8w-4h-4.5 w-9w-4.5h-5 w-10w-5