Repository navigation
feat(theme): align the card recipes with Open Components - #377
Merged
alexgrozav merged 3 commits intoOct 29, 2026
Merged
Conversation
Stretch the heading's link over the card, keep actions above it, and draw the focus ring around the card in color.focus. Hover only on hover-capable devices, full-strength borders with more contrast, system colours in forced colours mode, logical padding, and no clipping. Add a card-media part for the media rules.
Keep the card recipe working when a project defines no color.focus, stretch the link over the border, draw the forced-colours border from the setup selector, and add a focused story.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…d actions in place Subtract 1px from the media radius, since border-width.thin is the thin keyword that calc() can't use, wrap the actions-above selector in :where() so a recipe that positions its own element still wins, and pin the card's hover border in a test.
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 the
card,card-header,card-bodyandcard-footerrecipes in line with the Open Components Card page's stylesheet rules, and adds acard-mediarecipe (useCardMediaRecipe) for the media rules.::after. Links, buttons and fields elsewhere in the card sit above it (position: relative,z-index: 1).color.focusoutline, 2px outside its border (:has(a[href]:focus-visible)). It falls back tocolor.primarywhen a project defines nocolor.focus, like the global focus default.@media (hover: hover), the border gets stronger and the heading is underlined, only while the pointer is over the part of the card that follows the link.currentColorwithprefers-contrast: more(on hover too) and inCanvasTextin forced colours mode. The ring switches toHighlight.overflow: hidden, wraps long words withoverflow-wrap: break-wordand setsmin-width: 0.paddingInline. The media rounds its start corners with logical radii.card-mediashows above the header withorder: -1, so the heading comes first in the DOM, and keeps a16 / 9aspect ratio that its image fills.cardContrast.test.tschecks text at 4.5:1 for every colour × variant in both themes, and the ring at 3:1 against the page.<article>and an<h3>, inline styles are gone, and there are Linked, Focused, WithActions, WithMedia and LongContent stories. The docs page has a rewritten Accessibility section and documents the media part.No recipe name, axis, value or default changes. The changeset is
minorfor the new export.Related issue
Part of the work to align Styleframe's component styles 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
pnpm build:nodocs,pnpm lint(217 warnings, as on the base),pnpm typecheckand the theme tests (3690) pass.pnpm testfails only in@styleframe/playground'stest/theme.test.ts(8 tests,localStorage.clearis undefined under Node 26), which fails the same way on the base branch.main.contrast-moremodifier's class is emitted before the colour compounds' border classes and loses the cascade, so the more-contrast and forced-colours borders sit in a.card.card.cardsetup selector instead, which beats both the compound and the dark-theme classes.:where(), so a recipe or utility class that positions its own element, like the slider thumb, keeps its position inside a card.calc(<card radius> - 1px), sinceborder-width.thinis thethinkeyword, whichcalc()can't use.cardContrast.test.tschecks text and the focus ring, not the card border (1.45 to 1.69:1). The Card page'scard/contrastasks only for those two and calls the border decoration, since the heading says what the card is.-1pxrather than theborder-width.thintoken, which is thethinkeyword thatcalc()can't negate.card/media-ratio,card/text-below-media,card/heading-first) are met by the newcard-mediapart.