Files
greyhaven-design-system/htmx-demo
Mathieu Virbel 90930d8f78 feat(htmx-css): ToggleGroup support + padding/primary parity
Generator (scripts/generate-htmx-css.ts): track `viaVariants` per slot so
slots that compose another component's variant system (e.g. ToggleGroupItem
via toggleVariants) inherit the referenced CVA's base + variant rules under
their own selector. Previously toggle-group-item's CSS contained only its
override classes, shipping with no padding/height/hover/active state.

Toggle (components/ui/toggle.tsx):
  - data-[state=on] now uses bg-primary (orange) instead of bg-accent (grey),
    matching every other "commit" affordance in the palette.
  - Horizontal padding aligned with Button: px-4/px-3/px-6 per size, plus
    has-[>svg]:px-* for icon-only toggles.

ToggleGroup (components/ui/toggle-group.tsx): drop min-w-0 flex-1 shrink-0
from the item override. Items now size to content instead of being clamped
into equal narrow columns where longer labels overflowed the bg box.

Showcase: add ToggleGroup section to the React page (component-matrix.tsx)
and 1:1 HTMX mirror (public/htmx.html) with a new JS bridge branch for
single/multi-select. compare-all.sh extended with the new section; 22/22
pass at ≥99.97%.

Docs: GAPS.md captures the generator gap, overflow root cause, color
rationale, and padding parity with before/after numbers.
2026-04-24 14:43:55 -06:00
..

HTMX Showcase — Validation Harness

Parallel to app/page.tsx (the React showcase), public/htmx.html is a plain HTML page that exercises the generated dist/greyhaven.htmx.css across every static component. Load it while running pnpm dev at /htmx.html.

Purpose

Validate that greyhaven.htmx.css produces visually-equivalent output to the React components. The HTMX page only uses:

  • data-slot / data-variant / data-size attributes
  • Standard HTML tags (<button>, <span>, <input>, <div>)
  • Inline SVGs for icons (no lucide-react)

No React, no JavaScript (apart from the theme toggle).

Build

pnpm htmx-css:build      # Regenerate dist/greyhaven.htmx.css from components/ui/*.tsx
pnpm htmx-demo:build     # Compile htmx-demo/input.css + tokens + htmx.css → public/htmx.css
pnpm dev                 # Serves /htmx.html at http://localhost:3000/htmx.html

What's covered

  • Typography (H1/H2/H3 + body + UI label)
  • Button — variants (6), sizes (3), states (5), icon sizes (3)
  • Badge — core (4), tag/value (2), semantic (4), channel pills (5), on-muted-surface (6)
  • Input + Textarea (default / with value / disabled) + Label
  • Card (simple + with header/action/content/footer)
  • Alert (default + destructive)
  • Separator, Progress, Skeleton, Kbd

What's intentionally out of scope

  • Interactive components (Dialog, Dropdown, Popover, Select, Combobox, Accordion, Tabs, Tooltip) — their CSS rules exist in greyhaven.htmx.css but require Alpine.js or HTMX swap patterns for open/close state. Validate those in a separate runtime-integration test.
  • Form Control primitives with JS state (Checkbox, Switch, RadioGroup, Slider) — Radix renders these with bespoke markup the CSS targets via data-state=checked. Native <input type="checkbox"> won't match without additional bridging.