Skip to content

fix(theme): align the checkbox group recipe with Open Components - #379

Merged
alexgrozav merged 3 commits into
align-component-styles-uxf-487from
checkbox-group-styles-uxf-502
Oct 29, 2026
Merged

alexgrozav merged 3 commits into
align-component-styles-uxf-487from
checkbox-group-styles-uxf-502

Conversation

@alexgrozav

Copy link
Copy Markdown
Contributor

Description

Brings useCheckboxGroupRecipe in line with the stylesheet rules of the Open Components Checkbox Group page, so a group built on it is named by a legible legend, lays its options out the way people scan them and shows the group's disabled and invalid states.

  • Legend. The recipe now sits on a <fieldset>: it resets its border, padding, margin and minimum width, and styles its <legend> in @color.text (4.5:1 against the page in both themes) at the options' text size, in @font-weight.semibold. checkboxGroupContrast.test.ts checks the legend, and the invalid border's 3:1 against the page and every box colour, in both themes.
  • Layout. Options run in a column by default, at least 8px apart. A horizontal row puts 24px (gap-x: @1.5) between its options and wraps rather than overflowing. The size axis now sets the row gap with gap-y rather than gap, with the same values.
  • Select all. Options in [data-slot="options"] after a [data-slot="select-all"] box sit in from it by its box and gap, with padding-inline-start, so their boxes line up with its label, in either direction.
  • Disabled. A <fieldset disabled> dims its legend to 50%, and in forced colors mode turns it GrayText at full opacity. Each checkbox dims itself, as before.
  • Invalid. The group's aria-invalid="true" gives every box the checkbox's @color.error border and inset pixel, so no box grows. The focus ring stays @color.focus, and nothing styles :invalid.

Each size adds a -size-<size> class to the group, which the legend's size and the indent hang off. Storybook renders a fieldset with a legend and adds select-all, focus, invalid and disabled stories, and the docs page gains a "Parts and states" section and a rewritten Accessibility section. No variant name, value, default or export changes.

Related issue

None.

Type of change

  • 🐞 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behavior)
  • 📖 Documentation
  • ♻️ Refactor / internal (no functional change)
  • 🔧 Build / tooling / CI

Checklist

  • My commits follow Conventional Commits with a package scope (e.g. feat(theme): …)
  • I ran pnpm build:nodocs && pnpm lint && pnpm typecheck && pnpm test and everything passes (all pass except 8 @styleframe/playground tests in test/theme.test.ts, which fail the same way on the base branch: localStorage is undefined under the local Node version)
  • I added a changeset (pnpm changeset) for changes to publishable packages, or this change only touches docs/storybook/app/playground/tests
  • I added or updated tests where relevant
  • I updated documentation where relevant
  • I did not edit generated files (dist/, .styleframe/)
  • My PR targets main and stays focused in scope (it targets the align-component-styles-uxf-487 integration branch, and stays focused in scope)

Notes / screenshots

  • Error message. The page puts the hint and the error message outside the group, so the recipe doesn't style them, unlike the Radio Group's. The story renders the message after the fieldset in the page's text colour.
  • Invalid options. The page has the group pass aria-invalid on to each option, so each one reads invalid. The recipe also draws the invalid border from the group's attribute alone, so a group whose options don't carry it still looks invalid.
  • Legend weight. The page's reference CSS uses 600, so the legend is @font-weight.semibold, where the Radio Group's legend is medium.

…tandard

The checkbox-group recipe now meets the stylesheet rules of the Open
Components Checkbox Group page. It resets its fieldset and styles the
legend at the options' text size in a heavier weight, dims the legend of a
disabled fieldset, in GrayText in forced colors mode, and gives every box
the invalid border from the group's aria-invalid. A horizontal row puts
24px between its options, and options after a select-all box sit in from it
with padding-inline-start, so their boxes line up with its label.

The stories render a fieldset with a legend, and add select-all, focus,
invalid and disabled stories. The docs page describes the parts, the states
and what the recipe does for each rule.
@vercel

vercel Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
styleframe-dev Ready Ready Preview Oct 29, 2026 8:25pm UTC
styleframe-dev-storybook Ready Ready Preview Oct 29, 2026 8:25pm UTC

Request Review

…GrayText

The select-all box and the options wrapper take a full-width line with a
width rather than a flex basis, which set their height in a column group
and pulled them apart in a group taller than its content. A horizontal
group keeps its wrapped lines together with align-content: flex-start.

In forced colors mode, a disabled box in an invalid group keeps its
GrayText border, which the group's invalid border outranked.

The invalid-state test now checks the inset shadow's colour, the
resizable test the legend's margin token, and the FAQ asks the question
its answer gives.
@alexgrozav
alexgrozav merged commit e18ba07 into align-component-styles-uxf-487 Oct 29, 2026
3 checks passed
@alexgrozav
alexgrozav deleted the checkbox-group-styles-uxf-502 branch October 29, 2026 20:33

This branch was successfully deployed

2 active deployments
Preview – styleframe-dev — 239c43ee Deployed Oct 29, 2026 by vercel[bot]
Preview – styleframe-dev-storybook — 239c43ee Deployed Oct 29, 2026 by vercel[bot]
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