Skip to content

fix(shadcn)!: map the whole radius ladder, and show the components - #27

Merged
fajarhide merged 2 commits into
mainfrom
fix/shadcn-radius-and-components
Jul 30, 2026
Merged

fajarhide merged 2 commits into
mainfrom
fix/shadcn-radius-and-components

Conversation

@fajarhide

Copy link
Copy Markdown
Contributor

Two things, and the second is what found the first.

The bug

dist/shadcn.css set --radius: var(--wl-radius) and stopped there. Tailwind
resolves rounded-md from --radius-md, rounded-lg from --radius-lg, and so
on. None of those were mapped, so every corner in every consumer stayed on
Tailwind's defaults and the per-theme radius never rendered. paper's 3px corners
did not exist.

0.3.0 shipped that. This is 0.3.1.

The test that was supposed to catch it asserted --radius: var(--wl-radius) was
present, which it was. A check that confirms the thing you wrote is there, rather
than the thing you wanted to happen, is the kind that reads as coverage and is
not. It now asserts every step of the ladder, with a comment saying why.

Before and after, from the compiled output:

/* 0.3.0 */ .rounded-lg { border-radius: var(--radius-lg) }  /* Tailwind's 0.5rem */
/* 0.3.1 */ .rounded-lg { border-radius: var(--wl-radius) }  /* 10px, or 3px on paper */

Why it was not caught

Nothing had ever compiled the bridge. shadcn.css was asserted by regex, and a
regex cannot tell whether Tailwind produces a utility from it. A wrong
@theme inline block leaves bg-card compiling to nothing, the page renders
unstyled, and no unit test in this repo can see it.

So the docs site now compiles it. docs/src/tailwind.css imports
tailwindcss and dist/shadcn.css, and Tailwind v4 joins the devDependencies for
that one page.

The components page

/components renders shadcn new-york class strings on buttons in six variants,
badges, an input with a focus ring, a card, two alerts, a table, a sidebar,
skeletons, five chart series and a terminal. The same markup three times, with
only data-theme differing, so a role that works on one background and fails on
another has nowhere to hide.

This should have been in the original scope. #23 defers the component layer
because one consumer cannot tell us the API, and that argument is about
publishing a component contract other repos depend on. It says nothing about
showing components. Conflating the two left a design system site that could
not show a button, which is the one thing it exists to demonstrate. No components
ship in the package and #23 stays open.

One more fix found by looking at it: the showcase uses gap instead of
space-y-*. The docs site's global reset sets * { margin: 0 } and lands after
Tailwind's utilities, so margin-based spacing collapsed and every section sat
flush against the last.

Verification

  • 49 tests, npm test exits 0
  • npm run build && git diff --exit-code dist/ exits 0
  • every radius utility in the compiled CSS now reads the theme:
    rounded-md is calc(var(--wl-radius) * .875), rounded-full is
    var(--wl-radius-full)
  • ten utilities spot-checked in the compiled output, including bg-chart-3,
    bg-terminal, text-warning-foreground and focus-visible:ring-ring, which
    resolves to --tw-ring-color: var(--wl-ring)
  • opacity modifiers compile as promised:
    bg-primary/12 becomes color-mix(in oklab, var(--wl-primary) 12%, transparent)
    with a flat fallback
  • all three panels screenshotted in Chrome. paper's corners are visibly tighter
    than light and dark, which is the fix rendering
  • every link on the new page is absolute

Refs #23

BREAKING for anyone on 0.3.0 who relied on Tailwind's default corners.

shadcn.css set `--radius` and nothing else. Tailwind resolves `rounded-md` from
`--radius-md`, so every corner stayed on Tailwind's own defaults and the theme's
radius never rendered. `paper`'s 3px corners did not exist. The regex test passed
because `--radius` was in the file, which is exactly the kind of check that looks
like coverage and is not.

It was found by compiling the bridge for real for the first time. That is the
other half of this change.

The docs site now has a components page: shadcn `new-york` class strings on
buttons, badges, inputs, cards, alerts, tables, a sidebar, skeletons, chart
series and a terminal, rendered three times with only `data-theme` differing.
Tailwind v4 is a devDependency for this one page, and it earns its place: until
now dist/shadcn.css was asserted by regex and nothing had ever compiled it. A
wrong `@theme inline` block leaves `bg-card` producing nothing, and no unit test
can see that.

The showcase uses `gap` rather than `space-y-*`. The docs site's global reset
sets `* { margin: 0 }` and lands after Tailwind's utilities, so margin-based
spacing collapsed to nothing while gap survives.

Deferred as before: no components ship in the package, and #23's registry is
still the wrong move with one consumer. Showing components and publishing a
component API are different commitments, and conflating them is why this page
did not exist until now.

Refs #23
@vercel

vercel Bot commented Jul 30, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
design Ready Ready Preview Jul 30, 2026 6:33am

Two mistakes, in order.

The page ran to both edges because it had no `main.wrap`. The layout does not
supply one: index.astro and guide.astro each write their own, and that class is
what centres the column and pads it. There is now a test walking every page in
docs/src/pages and asserting it.

I read that as Tailwind preflight resetting `padding: 0` and removed preflight,
which was wrong twice over. It was not the cause, and shadcn's markup depends on
preflight's form-control reset: without it every `<button>` picks up the UA border
and the ghost and secondary variants render as boxes. Preflight is back, and the
comment in tailwind.css says why it stays.

The rest is the layout matching guide.astro rule for rule: the `padding-block`,
the back link, the h1 treatment, the lede measure, and the ruled `h2` that makes a
long page read as one document instead of three unrelated panels.
@fajarhide
fajarhide merged commit 93e2a35 into main Jul 30, 2026
3 checks passed
@fajarhide
fajarhide deleted the fix/shadcn-radius-and-components branch July 30, 2026 06:35

This branch was successfully deployed

1 active deployment
Preview — 84e0ee70 Deployed Jul 30, 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