feat(ui-card): add Card component with base and nested variants - #2660
Open
adamlobler wants to merge 6 commits into
Open
feat(ui-card): add Card component with base and nested variants#2660adamlobler wants to merge 6 commits into
adamlobler wants to merge 6 commits into
Conversation
Contributor
|
Contributor
Visual regression report
Diff images (33)alert.png — baseline no longer producedavatar.png — baseline no longer producedbadge.png — baseline no longer producedbillboard.png — baseline no longer producedbreadcrumb.png — baseline no longer producedbutton-and-derivatives.png — baseline no longer producedbyline.png — baseline no longer producedcalendar.png — baseline no longer producedcheckbox.png — baseline no longer producedcheckboxgroup.png — baseline no longer producedcolorpicker.png — baseline no longer producedcontextview.png — baseline no longer producedcustom-and-lucide-icons.png — baseline no longer produceddateinput-dateinput2.png — baseline no longer produceddatetimeinput.png — baseline no longer produceddiff-demo.png — 6324 pixels differdrilldown.png — baseline no longer producedfiledrop.png — baseline no longer producedform-errors.png — baseline no longer producedheading.png — baseline no longer producedimg.png — baseline no longer producedlink.png — baseline no longer producedmenu.png — baseline no longer producedmetric-pill-tag-timeselect-text.png — baseline no longer producedoptions.png — baseline no longer producedpagination.png — baseline no longer producedprogressbar.png — baseline no longer producedselect-simpleselect.png — baseline no longer producedtable.png — baseline no longer producedtabs.png — baseline no longer producedtooltip.png — baseline no longer producedtreebrowser.png — baseline no longer producedview.png — baseline no longer producedBaselines come from the |
…variants Card is a wrapper for grouping related content. The variant prop (base | nested) and size prop (sm | md | lg) are its only two options. The base variant renders a background, border colour and elevation shadow; the nested variant is meant to sit inside a base Card and omits all three, using a smaller border radius. Each size drives its own padding, border radius and min/max width breakpoints. Built on the v11.7 token system (useStyleNew plus generated Card theme tokens) rather than a legacy per-component theme.ts, so it resolves tokens across all four themes. This requires instructure-design-tokens v1.6.0, the release that adds the Card token set. Exported from the @instructure/ui v11_7 entrypoint. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Adds examples for each size, nested cards at every size, mixed sizes inside one base Card, and a base Card holding several nested Cards with heading and body copy. Adds a do/don't guidelines section for the two composition rules: a base Card must not contain another base Card, and a nested Card needs a surface behind it (a Card, Modal, or utility panel such as Tray) because it has no background colour of its own. Examples use Heading and Text rather than bare strings so example copy picks up token-driven colours and stays legible in dark mode. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…ion page Unit tests assert concrete token values (the 20rem and 40rem width breakpoints, and padding and radius relationships per variant) instead of only asserting that some value is set, so a swapped size or variant token fails the suite rather than passing silently. Adds the /card regression page and its axe check to the Cypress spec. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…mples The multiple nested cards example used Canvas-specific text (course settings, grading, notifications), which reads as domain-specific product copy rather than a generic component example. Swapped to lorem ipsum so the example stays neutral. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
The nested variant shared the same min-/max-width breakpoint tokens as base, but it renders inside base's padded content box. A nested card sized the same as (or larger than) its parent could structurally fail to fit once the parent was near its own min-width. nested no longer enforces a width at any size; size still scales its padding and border radius. Width now comes from the parent and the surrounding layout, matching the existing guidance to let nested cards wrap. Card hasn't shipped yet, so this isn't a breaking change for consumers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <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.

Summary
@instructure/ui-card: a wrapper withvariant(base|nested) andsize(sm|md|lg), built on the v11.7 token system (useStyleNew+ generated Card tokens) and exported from@instructure/ui/v11_7instructure-design-tokenstov1.6.0— the release that adds the Card token set/cardvisual regression page and its axe checkTest Plan
Heading/Textso they inherit token-driven colours rather than a browser default)nestedCards sit side by side cleanly inside onelgbaseCardcanvas (legacy)theme, comparebaseCard corner radii acrosssm/md/lg— see the token note below/cardbaselineNotes
pnpm-lock.yamlcarries 4 lines of drift unrelated to Card: vitest re-resolvedes-module-lexer2.1.0→2.2.0within its pre-existing^2.0.0range, which also cleared a now-staleoptional: trueflag on the 2.2.0 entry. Nopackage.jsonrange was changed and webpack still resolves 2.1.0.🤖 Generated with Claude Code