Migrating from local components
A product that built its own page header, metric card or status dot moves to the kit's: set up the registry, run the codemod, then finish by hand what it lists. Written for the LocalMind Portal's components/common; any shadcn new-york product maps the same way.
Set up the registry
Add @syncrobotic beside the product's own registry in components.json, then the theme and the items the codemod moves.
{
"registries": {
"@localmind": "https://localmind.xyz/r/{name}.json",
"@syncrobotic": "https://design-system.syncrobotic.me/r/{name}.json"
}
}npx shadcn add @syncrobotic/syncrobotic-theme
npx shadcn add @syncrobotic/status-glyph @syncrobotic/page-header @syncrobotic/section-header @syncrobotic/metric-card @syncrobotic/empty-state Import the theme in globals.css, delete the product's own :root, .dark, .light and @theme colour blocks, and keep the brand in the brand layer. node lists every theme token still redefined and every brand pair below its contrast.
The kit installs into the same folders. In the Portal, card, button, alert-dialog, calendar, label and popover already exist in components/, and @syncrobotic/ writes lib/, which would shadow lib/. The CLI asks before it overwrites: decline cn (the same function) and take the others one at a time, on purpose: the kit's Button is primary, secondary, outline, not default.
The brand: Design tokens, brand layer. Statuses: healthy is grey.
Order
- Theme and brand. No call site changes; the product looks like the kit in its own purple.
- Statuses: StatusDot to StatusGlyph, and
status-tone.tsto the decision record's table. Grey when healthy. - The codemod: PageHeader, SectionHeader and Section, MetricCard, EmptyState, StatusDot.
- By hand: DetailField, ConfirmDialog, DateRangeField, and the notes the codemod printed.
- Delete the local files.
npmlists every look-alike still defined, with its kit item.run adoption -- ../ portal
Codemod
# In a checkout of the design system, next to the product's
node scripts/codemods/portal-to-kit.mjs ../portal/src # dry run: a diff and the notes, nothing written
node scripts/codemods/portal-to-kit.mjs ../portal/src --write # apply
npm run adoption -- ../portal # what is left: every look-alike still definedIt parses each file with the TypeScript compiler and changes only what it touches: the imports (to @/, StatusGlyph to @/; --ui, --components and --link-from follow other aliases), the renamed props, StatusDot's statuses where every value is written in the file, EmptyState's action, Section's wrapper, and the imports a dropped prop leaves unused. Each dropped prop and each thing left to do is printed with its file and line.
What it cannot do: rebuild PageHeader's actions and back, merge a grid of DetailFields into one list, rewrite a ConfirmDialog or a DateRangeField, map a status that comes from a variable, follow relative imports or spread props, or decide whether a pending state waits on a person or a process. Formatting is left to the product's formatter.
PageHeader
| Local | Kit | How |
|---|---|---|
title, description, className | the same | The title is an h1; as="h2" under another h1. |
badge | badges | A state (online, revoked) goes in status as one InlineStatus, not in a badge. Codemod. |
back={{ | breadcrumb | A Breadcrumb ending at the parent page. |
actions={{ | actions | The buttons themselves: a primary Button and secondary ones; more than two fold into a DropdownMenu with DropdownMenuMoreTrigger. |
icon, avatar, avatarUrl, avatarFallback, colorTheme | none | Dropped: the breadcrumb says where, the title says what. Codemod. |
| (none) | meta, status | Facts as MetaPills (counts, owner, last update); the page's state as InlineStatus. |
MetricCard
| Local | Kit | How |
|---|---|---|
label, value | the same | The value already formatted (formatCount). |
description | caption | Codemod. |
isLoading | loading | Codemod. |
internalHref | href with linkAs={Link} | Codemod, importing your router's Link. |
href (a new tab) | none | The kit's href stays in the tab; link to a page of your own. |
valueClassName (a colour) | tone | warning or danger, with the reason in caption. The value stays ink. |
footer (a sparkline) | series | The last values, oldest first. |
icon, compact | none | Dropped; MetricGrid lays out the row. Codemod. |
onClick | none | A card is a link or nothing: a Button in caption, or a page. |
| (none) | unit, delta, trend, unavailable | unavailable shows a dash and why, never a made-up 0. |
SectionHeader, Section and SubsectionHeader
| Local | Kit | How |
|---|---|---|
SectionHeader title, description | the same | 16 px bold h2, outside cards. |
action | actions | Codemod. |
Section (header and children) | <section> with SectionHeader first | Codemod: gap-3, a className merged with cn. |
SubsectionHeader | SectionHeader | 14 px medium h3, inside a card. Codemod. |
icon, tone, iconClassName, align | none | Dropped: a heading is never coloured; say the state in words. Codemod. |
| (none) | count, as, id | count is written in full (1,284). |
DetailField to DescriptionList
| Local | Kit | How |
|---|---|---|
a grid of DetailFields | one DescriptionList | items={[{ with columns (1–4) and variant (plain in a card, bare on one). |
label, children | label, value | An empty value is a dash, heard as Not set. |
hint, mono, icon | the same | On the item. |
hintAs="tooltip" | none | The hint is always under the value. |
| (none) | copy | A copy button after an id or a fingerprint. |
EmptyState
| Local | Kit | How |
|---|---|---|
title, description, icon, className | the same | The kit draws no icon by default (the Portal drew a Box). |
actionLabel with actionHref or onAction | action | The Button itself. Codemod. |
eyebrow | none | Dropped. Codemod. |
| (none) | size, variant | inline in a table or list; overlay over a canvas. |
ConfirmDialog to AlertDialog
| Local | Kit | How |
|---|---|---|
open, onOpenChange | AlertDialog | The same props. |
title, description | AlertDialogTitle, AlertDialogDescription | The title is the question. |
confirmLabel, cancelLabel | the children of AlertDialogAction, AlertDialogCancel | Required: name the consequence ("Revoke key"), never "Confirm". |
variant="destructive" | AlertDialogAction | The danger outline; never solid red. |
isLoading, confirmDisabled, confirmIcon | a Button inside AlertDialogAction | loading, disabled, the icon as a child. |
DeleteConfirmDialog | the destructive confirm pattern | What is lost, who it affects, the name typed for the worst cases. |
InlineConfirmDialog trigger | AlertDialogTrigger | Uncontrolled. |
To move the look before the call sites, keep the props and build them on the kit's parts:
"use client"
import * as React from "react"
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog"
import { Button } from "@/components/ui/button"
// The Portal's ConfirmDialog props on the kit's AlertDialog, so its call sites keep working while the look moves to the
// kit. The words are required: the confirm names the consequence ("Revoke key"), never "Confirm".
export function ConfirmDialog({
open,
onOpenChange,
title,
description,
confirmLabel,
cancelLabel,
variant = "default",
isLoading = false,
confirmDisabled = false,
confirmIcon,
onConfirm,
children,
}: {
open: boolean
onOpenChange: (open: boolean) => void
title: string
description?: string
confirmLabel: string
cancelLabel: string
variant?: "default" | "destructive"
isLoading?: boolean
confirmDisabled?: boolean
confirmIcon?: React.ReactNode
onConfirm: () => void
children?: React.ReactNode
}) {
return (
<AlertDialog open={open} onOpenChange={onOpenChange}>
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>{title}</AlertDialogTitle>
{description && <AlertDialogDescription>{description}</AlertDialogDescription>}
</AlertDialogHeader>
{children}
<AlertDialogFooter>
<AlertDialogCancel disabled={isLoading}>{cancelLabel}</AlertDialogCancel>
<AlertDialogAction asChild>
{/* The danger outline for a destructive confirm: solid red is the emergency stop's alone. */}
<Button
variant={variant === "destructive" ? "destructive" : "primary"}
loading={isLoading}
disabled={confirmDisabled}
onClick={onConfirm}
>
{!isLoading && confirmIcon}
{confirmLabel}
</Button>
</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
)
}DateRangeField to DateRangePicker
| Local | Kit | How |
|---|---|---|
from, to (YYYY-MM-DD) | value ({ ) | parseISO in, format(d, out, for the URL. |
onFromChange, onToChange | onValueChange(range) | One callback for the range. |
label | a Field label, or aria-label | Which date the range bounds. |
| the clear button | clearable | |
to not before from | built in | A range calendar cannot pick it. |
| (none) | presets, locale, labels | datePickerLabels from labels-zh-tw. |
StatusDot to StatusGlyph
| Local | Kit | How |
|---|---|---|
status="online" | status="normal" | Codemod. |
status="pending" | status="warning" | Waiting on a person: warning. Waiting on a process: active. Codemod picks warning. |
status="error" | status="danger" | Codemod. |
status="info" | status="active" | Codemod. |
status="offline" | status="offline" | Codemod. |
size, pulse | none | 12 px; loops are only for waiting. Dropped. Codemod. |
| a colour only | a shape, and the word beside it | The glyph is hidden from screen readers: write the status (InlineStatus draws both). |
No equivalent yet
- A page icon or avatar in the header, coloured icon tiles (
colorTheme), and a stat card's icon: left out on purpose, colour is for what is abnormal. - A metric card that opens a dialog (
onClick) or a new tab, and a hint folded into a tooltip (hintAs). - The
brandtone ofstatus-tone.ts: a role or a plan is a fixed attribute, an outline Badge, not a state. - String dates in a date range: the picker takes Dates; the URL keeps the strings.