Skip to content

feat(ui-card): add Card component with base and nested variants - #2660

Open
adamlobler wants to merge 6 commits into
masterfrom
feat/ui-card
Open

feat(ui-card): add Card component with base and nested variants#2660
adamlobler wants to merge 6 commits into
masterfrom
feat/ui-card

Conversation

@adamlobler

@adamlobler adamlobler commented Jul 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add @instructure/ui-card: a wrapper with variant (base | nested) and size (sm | md | lg), built on the v11.7 token system (useStyleNew + generated Card tokens) and exported from @instructure/ui/v11_7
  • Bump instructure-design-tokens to v1.6.0 — the release that adds the Card token set
  • Document Card with per-size nested examples, mixed sizes inside one base Card, and do/don't composition guidelines
  • Add unit tests asserting concrete token values, plus the /card visual regression page and its axe check

Test Plan

  • Docs → Card: switch the Theme selector to a dark theme and confirm example copy stays legible (examples use Heading/Text so they inherit token-driven colours rather than a browser default)
  • Docs → Card → "Mixed sizes": confirm differently-sized nested Cards sit side by side cleanly inside one lg base Card
  • Under the canvas (legacy) theme, compare base Card corner radii across sm/md/lg — see the token note below
  • Visual regression: review the new /card baseline

Notes

  • pnpm-lock.yaml carries 4 lines of drift unrelated to Card: vitest re-resolved es-module-lexer 2.1.02.2.0 within its pre-existing ^2.0.0 range, which also cleared a now-stale optional: true flag on the 2.2.0 entry. No package.json range was changed and webpack still resolves 2.1.0.

🤖 Generated with Claude Code

@adamlobler adamlobler self-assigned this Jul 27, 2026
@adamlobler
adamlobler requested a review from balzss July 27, 2026 13:58
@github-actions

github-actions Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://instructure.design/pr-preview/pr-2660/

Built to branch gh-pages at 2026-07-29 11:57 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

github-actions Bot pushed a commit that referenced this pull request Jul 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Visual regression report

⚠️ Changes detected.

Status Count
Unchanged 0
Changed 1
New 99
Removed 32

📊 View full report

Diff images (33)

alert.png — baseline no longer produced

avatar.png — baseline no longer produced

badge.png — baseline no longer produced

billboard.png — baseline no longer produced

breadcrumb.png — baseline no longer produced

button-and-derivatives.png — baseline no longer produced

byline.png — baseline no longer produced

calendar.png — baseline no longer produced

checkbox.png — baseline no longer produced

checkboxgroup.png — baseline no longer produced

colorpicker.png — baseline no longer produced

contextview.png — baseline no longer produced

custom-and-lucide-icons.png — baseline no longer produced

dateinput-dateinput2.png — baseline no longer produced

datetimeinput.png — baseline no longer produced

diff-demo.png — 6324 pixels differ

drilldown.png — baseline no longer produced

filedrop.png — baseline no longer produced

form-errors.png — baseline no longer produced

heading.png — baseline no longer produced

img.png — baseline no longer produced

link.png — baseline no longer produced

menu.png — baseline no longer produced

metric-pill-tag-timeselect-text.png — baseline no longer produced

options.png — baseline no longer produced

pagination.png — baseline no longer produced

progressbar.png — baseline no longer produced

select-simpleselect.png — baseline no longer produced

table.png — baseline no longer produced

tabs.png — baseline no longer produced

tooltip.png — baseline no longer produced

treebrowser.png — baseline no longer produced

view.png — baseline no longer produced

Baselines come from the visual-baselines branch. They refresh on every merge to master.

@adamlobler
adamlobler removed the request for review from balzss July 27, 2026 15:17
github-actions Bot pushed a commit that referenced this pull request Jul 27, 2026
@adamlobler
adamlobler requested review from HerrTopi and matyasf July 28, 2026 10:25
adamlobler and others added 5 commits July 29, 2026 13:19
…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>
github-actions Bot pushed a commit that referenced this pull request Jul 29, 2026
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>
github-actions Bot pushed a commit that referenced this pull request Jul 29, 2026
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