Repository navigation
feat(theme): align the switch recipes with the Open Components Switch page - #372
Merged
alexgrozav merged 2 commits intoOct 29, 2026
Merged
Conversation
… page Each off track now keeps 3:1 against the page in both themes, with a knob at 3:1 against it, and the focus ring is color.focus. The field takes its invalid and read-only looks from aria-invalid and aria-readonly, sizes in rem, mirrors its knob in right-to-left layouts and stops sliding with reduced motion. The wrapper label gives a 24px hit area, 44px on touch screens. Forced colors and more contrast draw the switch in system and full-strength colors.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
7 of 13 tasks
This branch was successfully deployed
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.
Description
Brings
useSwitchRecipeanduseSwitchFieldRecipein line with the stylesheet rules on the Open Components Switch page, without renaming or removing any recipe, axis, value or default.neutralisgray-450in both modes,lightis agray-200track with agray-500border and agray-600knob, anddarkgets agray-450border.switchContrast.test.tschecks every color, on and off, in both themes, plus the focus ring and the error border.@color.focus, 2px solid with a 2px offset, in every state.aria-invalid="true"(an error border doubled by a 1px inset shadow), read-only fromaria-readonly="true"(a dashed border that shows against the page), and disabled from:disabled. None of them changes the switch's size.rem, with the same pixel values at 16px. The knob is now aradial-gradient()background, so it takes color tokens, and it starts at the inline start, so it mirrors in right-to-left layouts. The wrapper label is at least 24px tall, and 44px on touch screens, which gives the switch its hit area.prefers-reduced-motion. In forced colors mode the field opts out withforced-color-adjust: noneand draws every state in system colors. Withprefers-contrast: more, the off border takes the text color.ReadOnly,ReadOnlyChecked,InvalidandFocusstories, read-only and invalid rows inAllStates, and an updated Switch page with an Accessibility section.Related issue
Part of the work to align the component recipes with Open Components.
Type of change
Checklist
feat(theme): …)pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm testand everything passespnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/testsdist/,.styleframe/)mainand stays focused in scopeNotes / screenshots
apps/playground/test/theme.test.ts: its 8 tests fail onlocalStorage.clearon the base branch too.main.switch/hover-capableholds with nothing behind the modifier.neutraloff track is a mid gray in both modes instead ofgray-300/gray-700, thelightknob is gray while off, and the wrapper label grows to a 24px minimum height.