# Use Delta with shadcn

Requires React, Tailwind 4, CSS variables, and standard `.dark` theme selection.
Components use configured shadcn Lyra / Base UI. Theme-only adoption also works
with existing Radix components and leaves their implementation unchanged.

## New project

```sh
pnpm dlx shadcn@4.23.0 init --preset buFyykS --base base --pointer --template next --name my-app
cd my-app
```

Use `--template vite` for Vite. Add this namespace to `components.json`, retaining
its other fields:

```json
{
  "registries": {
    "@delta": "https://amiri.cc/r/{name}.json"
  }
}
```

Install only the components you need:

```sh
pnpm dlx shadcn@4.23.0 add @delta/button @delta/card @delta/input
```

Ordinary headings and anchors receive base styling automatically. Use named
classes such as `site-container`, `guide-prose`, and `scanlines` for presentation.
For scanlines use `<div className="scanlines" aria-hidden="true" />` inside a
positioned container. These styles are included with the theme; no styling-only
React components are needed. Mark special unstyled anchors with
`data-link-unstyled`; component-owned anchors use their data-slot.

Entries depend on `@delta/theme` and declare their required npm/UI dependencies.
They copy editable source into the configured UI directory using standard names,
without Delta prefixes. Complete the hosted font setup below.

```jsx
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";

<Card>
  <CardContent>
    <Button variant="raised" size="navigation">Get started</Button>
  </CardContent>
</Card>
```

The registry index at `/r/registry.json` lists available entries. For a missing
component, start from the configured Lyra component, retain unresolved design
choices, and centralize any new approved styling in shared variants and tokens.

## Existing project: theme only

```sh
pnpm dlx shadcn@4.23.0 add https://amiri.cc/r/theme.json
```

Or configure the namespace above and add `@delta/theme`. This entry adds palette,
font-family, shared visual/motion tokens, pointer, reduced-motion, and print CSS.
It contains no component source or dependencies. Existing components, providers,
theme selection, RTL, routing, and application logic stay consumer-owned.
Custom hardcoded styling requires deliberate adoption.

## Existing project: selected components

After configuring the namespace, inspect the proposed changes:

```sh
pnpm dlx shadcn@4.23.0 add @delta/button --dry-run
pnpm dlx shadcn@4.23.0 add @delta/button --diff
pnpm dlx shadcn@4.23.0 add @delta/button
```

This is optional for other projects; shared components are mandatory within the
portfolio. Standard filenames can conflict with existing shadcn files. Review
and merge those conflicts explicitly. Do not use `--overwrite` without reviewing
and authorizing the replacement. Keep a clean commit before migration.

Component entries use Base UI. Radix consumers can keep the theme alone or
explicitly migrate selected source and call sites to Base UI APIs, including
`render` composition rather than Radix `asChild`. Existing application imports,
providers, forms, routing, state, and unrelated components are not rewritten.

## Hosted font setup

Add this to the document head (Next.js root layout or Vite index.html):

```html
<link rel="stylesheet" href="https://amiri.cc/delta/assets/css/fonts.css">
```

It declares JetBrains Mono's six Google-hosted WOFF2 subsets, weights 100–800,
with display=swap and a monospace fallback. No font binaries are copied. The
pinned CLI cannot emit font-face descriptors, so registry adoption needs this
head link. The portable stylesheet embeds the same faces directly.

## Updates and upstream changes

Installed source belongs to the receiving project. Registry updates do not
silently synchronize it. Inspect `--dry-run`/`--diff`, then merge deliberately.
Keep standard shadcn APIs and Base UI behavior intact when updating Delta variants.
Do not regenerate or force-overwrite approved customizations blindly.

For a full preset migration, first review `pnpm dlx shadcn@4.23.0 apply buFyykS`.
That can regenerate source; reapply/reconcile approved Delta components afterward.
Theme installation alone never migrates component source.

## Manual theme CSS

Download `/delta/assets/css/delta-theme.css` and import it after Tailwind and
stock shadcn imports. It includes the same shared tokens, behavior, print rules,
and hosted faces; no separate fonts.css link is needed. It does not install
components or change your theme controller. Back up CSS before adoption.
Reconcile a consumer's existing `@theme inline` font alias during manual adoption: set
`--font-mono: "JetBrains Mono", monospace;` so a stock variable-font alias does not
override the supplied hosted font. Registry installation configures this token;
manual CSS adoption must make the same explicit choice in consumer CSS.

All 50 reference shades remain available as variables and utilities. Use semantic
tokens in components. Custom CSS and canvas must reference the same shared values;
mathematical/runtime geometry remains allowed. Define missing reusable visual
values centrally in Tailwind's theme.

Registry assets are generated by dev/build and published only through verified
master CI. Component installation URLs become available after that publication;
local generation and checks do not publish.
