Skip to content

feat: add Fact primitive (ported from Post for Me)#1

Open
calebpanza wants to merge 2 commits into
mainfrom
cyrus/cui-4-review-post-for-me-fact-primitive-for-crescent-ui
Open

feat: add Fact primitive (ported from Post for Me)#1
calebpanza wants to merge 2 commits into
mainfrom
cyrus/cui-4-review-post-for-me-fact-primitive-for-crescent-ui

Conversation

@calebpanza

@calebpanza calebpanza commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Assignee: Caleb Panza

Summary

Ports the Fact primitive from the Post for Me dashboard into the Crescent UI registry. A Fact is a compact, read-only label→value block for detail/summary surfaces — ids, dates, status, counts. Lay several out in a flex/grid for a "facts strip" (the canonical account/post detail-page pattern).

<Fact label="Connected">May 15, 2026</Fact>
<Fact label="Connected" orientation="horizontal">May 15, 2026</Fact>

The value slot is freeform — plain text, a monospaced id, a badge, a copyable, an avatar, etc.

Orientation (review feedback)

Per the review on CUI-4, Fact now takes an orientation prop:

  • "vertical" (default) — the original stacked cell: small uppercase label above its value.
  • "horizontal" — label and value on one row (label | value), the settings-style row look. Give the label a width (e.g. [&_[data-slot=fact-label]]:w-24) to align values down a column.

Implementation notes:

  • Flex direction is structural and stays inline (flex-row items-baseline vs flex-col).
  • The per-orientation gap is driven from the data-orientation attribute via the cn-fact token (gap-1 data-[orientation=horizontal]:gap-2), so spacing remains style-tunable per style — and resolves cleanly through the registry build (a cn-* token inside a JSX ternary would not be resolved by transformStyle).

Source

Faithfully ported from app/ui/fact.tsx in the post-for-me-dashboard repo. The label prop + children value API is kept identical to how the dashboard consumes it.

What's included (per the crescent-component conventions)

  • registry/bases/{base,radix}/ui/fact.tsx — Fact is a pure-div display primitive with no interactive library, so the two variants are byte-for-byte identical (no "use client"). Both ship so radix-* consumers can install it.
  • cn-fact / cn-fact-label / cn-fact-value tokens in all 8 style CSS files — typography/color/spacing live in the style layer; only structural flex/min-w-0 is inline. cn-fact now carries the orientation gap variant.
  • registry.json + scripts/build-registry.ts entries (fact + fact-radix, no npm dependencies).
  • Showcase: app/showcase/components/fact-demo.tsx — facts-strip hero, freeform-value examples, and a new Horizontal example. Stays dependency-free (no Badge/Copyable, which aren't in Crescent yet).
  • registry-dist/ regenerated — 32 items, no unresolved cn-* tokens.

Verification

  • bun run registry:build — 32 items across 8 styles, no token leaks
  • bun run typecheck
  • bun run lint
  • bun run build

Closes CUI-4.


Tip: I will respond to comments that @ mention @cyrus-daymoon on this PR. You can also submit a review with all your feedback at once, and I will automatically wake up to address each comment.

A compact, read-only label→value block for detail/summary surfaces (ids,
dates, status, counts). Ported from the Post for Me dashboard's app/ui/fact.tsx
into the Crescent registry conventions:

- registry/bases/{base,radix}/ui/fact.tsx (identical — pure display primitive,
  no interactive library)
- cn-fact / cn-fact-label / cn-fact-value tokens added to all 8 style CSS files
- registry.json + build-registry.ts entries (fact + fact-radix)
- showcase demo (fact-demo.tsx) + demos.tsx registration
- regenerated registry-dist (32 items, no unresolved cn-* tokens)

Closes CUI-4
@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
crescent-ui Ready Ready Preview, Comment Jun 29, 2026 3:07pm

Request Review

Adds an `orientation` prop ("vertical" default | "horizontal") so a Fact can
render as a settings-style label | value row instead of the stacked cell.
Direction is structural (inline flex-row/flex-col); the per-orientation gap is
driven from data-orientation via the cn-fact token, so spacing stays
style-tunable. Updates both base + radix variants, all 8 style CSS files, the
showcase demo, and regenerates registry-dist.

Addresses review feedback on CUI-4.
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