Componentize

Turn a reference into a shippable Life React component in packages/life/src plus its HTML catalog specimen (preview.html). Use for /componentize when adding or updating a reusable UI building block for Sarvam apps (e.g. Software Factory).

Production-ready: PRODUCTION_READY.md · Index. This skill closes checklist items: React in Life, Tatva prop names (when applicable), agent-readable docs (start), unit tests (start), and specimen alignment for visual regression (with Plate My Component). Before ship, add <Name>.production-ready.test.tsx (axe + light/dark snapshots — see Button.production-ready.test.tsx). Remaining items → component-cycle.

Read AGENTS.md (tokens, theme, icons, focus) and Life DESIGN.md for visual rules and specimen guidance. Style with packages/life/design-system/tokens.css (--sv-*) and bundle.css recipes — not legacy life.css.

  1. Inspect the supplied component reference at its intended size. Note its structure, dimensions, alignment, spacing, type, color, assets, and visible states. For choices the reference leaves open (or when there is no reference), apply visual-direction: assign each surface a role, keep radii concentric, and keep colour in glyphs. Keep the reference geometry as precise as the system allows.
  2. Check whether packages/life/src/<Name>/ already ships the React component, and whether a Studio catalog preview exists at apps/studio/src/lib/life-specimens/previews/<Name>.tsx. Reuse when they match; adapt the closest pair when the reference is a variant of an existing block. Add a new shippable React component only when the reference is a distinct reusable UI piece.
  3. Follow catalog preview conventions in Studio for the docs prototype only. Use semantic tokens, fonts, and bundled assets. Use a primitive when the semantic layer has no suitable role and call out the gap. Keep one-off values local when there is no token fit. A token change requires separate scope and the synchronization steps in AGENTS.md. Icons: no custom icons and no hand-written or inline SVG, even when the reference draws its own glyphs. Use the closest Hugeicons icon from the existing icon library (reuse before adding): Standard stroke by default, solid where the state or context calls for it. SVG files are allowed only for logos and brand marks, such as model logos. Note any glyph with no Hugeicons match as a gap.
  4. Build the shippable React component in packages/life/src/<Name>/ for Sarvam product apps. When a Tatva counterpart exists, follow Tatva parity. The HTML specimen is the visual contract for the catalog; the React module is what ships. Write index.tsx, required <Name>.docs.mdx per COMPONENT_DOCS.md, and tests.
    • Styling is the one allowed difference: map variant props, through cva, to the bundle.css recipe classes the specimen uses. No inline styles, no CSS-in-JS. A missing recipe class goes into bundle.css and is used in both specimen and React. Tailwind-ported components (Badge, Text) have no preview.html or recipe CSS: they style with cva + Tailwind utilities from the Life bridge (@sarvam/life/tailwind-theme.css) and register their catalog meta in apps/studio/src/lib/life-specimens/catalog-meta.ts.
    • Icons: the shared Icon from @sarvam/life, Hugeicons only. If packages/life/src has no Icon yet, promote the app's Icon from apps/studio/src/app/(products)/_components/ui.tsx into packages/life/src/Icon/ and leave the old export re-exporting it.
    • Dependencies: only the ones the parity reference allows.
    • Run pnpm exec tsc --noEmit and pnpm lint. Produce the parity table.
    • Before claiming production-ready, walk the rest of PRODUCTION_READY.md (or run component-cycle).
  5. For a new or materially changed catalog specimen, follow Plate My Component. Keep plating at specimen scope (HTML only unless the user asked to change packages/life/src). Use the group-view test when the React component has many variants and sizes.
  6. Compare the HTML specimen against the reference at the same viewport and scale. Check dimensions, alignment, clipping, and themes in both specimen and React. Return the catalog link, the preview.html path, the packages/life/src path, and any material differences or token gaps.

Catalog badges: Green dot = shippable React in packages/life/src meeting PRODUCTION_READY.md with a recorded checklist review. Orange T = also in Tatva — Tatva parity. Specimens alone do not earn the green dot.

Gaps to check for before building from scratch

Reusable pieces that prototypes keep rebuilding: multi-level picker menu with locked and pinned items, boxed radio rows, settings page shell with pinned footer, resizable right pane, collapsible section with inset hover, compact boxed rows, picker dialog, row action menu, select field, hue tag, chat transcript, shared radius token. Missing states (read-only, locked, loading) belong on the component that exists, as a prop and a state, never as a new component. Check GAPS.md in apps/studio/src/app/(products)/prototypes/*/ before writing a new one.