# Create your first app (/docs/create-your-first-app)
```bash
npx create-signet-app@latest my-app --template full
cd my-app
npm install
npm run dev
```
```bash
pnpm create signet-app my-app --template full
cd my-app
pnpm install
pnpm run dev
```
```bash
bunx create-signet-app my-app --template full
cd my-app
bun install
bun run dev
```
`full` needs [Bun](https://bun.sh) 1.3+ installed, even when npm or pnpm installs it: `run dev` is a Bun script.
### Scaffold [#scaffold]
The first command above makes `my-app` with the `editorial` theme. The directory must not exist or be empty.
### Install and run [#install-and-run]
`install`, then `run dev`. The API and Vite start together.
### Open the app [#open-the-app]
Open `http://localhost:5173`. Sign in with any phone number; the code prints in your terminal.
### Make your first edit [#make-your-first-edit]
Change the `CardTitle` on line 17 (it starts as `Hello`). The page reloads on save.
```tsx title="src/routes/_app/index.tsx"
import { CardTitle } from "@dapplelight/signet-ui/components/card"
Welcome to my app
```
# Deploy (/docs/deploy)
| Target | Command | Docs |
| --- | --- | --- |
| `full` | `bun run build`, then `bun run start` | [Project structure](/docs/project-structure) |
| `api --target cloudflare` | `wrangler deploy` | [API targets](/docs/packages/create-signet-app/flags#api-targets) |
| `api --target vercel` | `vercel deploy` | [API targets](/docs/packages/create-signet-app/flags#api-targets) |
| `api --target bun` | `docker build -t my-api .` | [API targets](/docs/packages/create-signet-app/flags#api-targets) |
| `api --target node` | `bun run start` | [API targets](/docs/packages/create-signet-app/flags#api-targets) |
`docker run -p 3000:3000 my-api` runs the Bun image.
Before production, `full` needs `APP_ENV=production`, `SESSION_SECRET`, `OTP_SECRET` and `ADMIN_PHONES` set on the host, a volume for `DATABASE_PATH`, and a real SMS sender in `api/services.ts`.
# First API route (/docs/first-api-route)
### Add the route [#add-the-route]
Chain it next to `/api/health`. Chaining is what types the client.
```ts title="api/app.ts"
import { Hono } from "hono"
const base = new Hono()
const app = base
.get("/api/health", (c) => c.json({ ok: true }))
.get("/api/hello", (c) => c.json({ message: "Hello" }))
```
### Call it [#call-it]
`src/lib/api.ts` already exports the client. The path and response type come from the route.
```tsx title="src/routes/_app/index.tsx"
import { useQuery } from "@tanstack/react-query"
import { api } from "../../lib/api"
const hello = useQuery({
queryKey: ["hello"],
queryFn: async () => (await api.hello.$get()).json(),
})
//
{hello.data?.message}
```
### Check it [#check-it]
Save. The page shows `Hello`. Rename the field in the route and `bun run typecheck` fails in the page.
# First component (/docs/first-component)
### Import it [#import-it]
```tsx title="src/routes/_app/index.tsx"
import { Badge } from "@dapplelight/signet-ui/components/badge"
```
### Use it [#use-it]
```tsx title="src/routes/_app/index.tsx"
import { CardTitle } from "@dapplelight/signet-ui/components/card"
import { useQuery } from "@tanstack/react-query"
import { meQuery } from "../../lib/api"
function Home() {
const me = useQuery(meQuery).data
return (
Hello {me?.plan ?? "free"}
)
}
```
The page reloads with a badge in the title.
### Try a variant [#try-a-variant]
```tsx
import { Badge } from "@dapplelight/signet-ui/components/badge"
Beta
```
Variants and props: [Badge](/docs/components/badge).
# Introduction (/docs)
Signet is a design system and backend kit for React apps. Your app holds only its own business logic.
Vite + React + Tailwind v4 on the front, Hono on Cloudflare Workers behind.
- Install packages to get updates.
- Run `signet add` to copy source you own.
## How it fits [#how-it-fits]
| Layer | Packages | You get |
| --- | --- | --- |
| Frontend | `@dapplelight/signet-ui`, `@dapplelight/signet-tokens`, `@dapplelight/signet-lib` | Components, themes, API client, forms |
| Backend | `@dapplelight/signet-server`, `@dapplelight/signet-db`, `@dapplelight/signet-payments`, `@dapplelight/signet-ai` | Auth, middleware, tables, billing, models |
| Tooling | `create-signet-app`, `@dapplelight/signet-cli`, `@dapplelight/signet-mcp`, `@dapplelight/signet-config`, `@dapplelight/signet-test` | Scaffold, copy-in, agents, presets, fakes |
## Example [#example]
```tsx title="src/routes/index.tsx"
import { createApiClient } from "@dapplelight/signet-lib/api"
import { Button } from "@dapplelight/signet-ui/components/button"
import { useState } from "react"
const api = createApiClient({ baseUrl: "/api" })
export function Home() {
const [text, setText] = useState("Say hello")
const load = async () => setText((await api.get<{ text: string }>("/hello")).text)
return
}
```
```ts title="api/index.ts"
import { errorHandler } from "@dapplelight/signet-server/http"
import { requestId, secureHeaders } from "@dapplelight/signet-server/middleware"
import { Hono } from "hono"
const app = new Hono()
app.use(requestId(), secureHeaders())
app.onError(errorHandler({ isProduction: true }))
app.get("/api/hello", (c) => c.json({ text: "Hello from Workers" }))
export default app
```
### Frontend [#frontend]
### Backend [#backend]
### Tooling [#tooling]
## 60-second start [#60-second-start]
```bash
npx create-signet-app@latest my-app --template full
cd my-app
npm install
npm run dev
```
```bash
pnpm create signet-app my-app --template full
cd my-app
pnpm install
pnpm run dev
```
```bash
bunx create-signet-app my-app --template full
cd my-app
bun install
bun run dev
```
Open `http://localhost:5173`. `full` needs [Bun](https://bun.sh) 1.3+ installed, even when npm or pnpm installs it: `run dev` is a Bun script. It is a web app and an API with sign-in, billing, admin and privacy already wired.
## For agents [#for-agents]
# Installation (/docs/installation)
| Path | Use it when | Start |
| --- | --- | --- |
| Scaffold | New project | [Create your first app](/docs/create-your-first-app) |
| Existing React app | You have Vite, React 19 and Tailwind v4 | Steps below |
## Prerequisites [#prerequisites]
| Need | Version | Why |
| --- | --- | --- |
| Node.js | 22+ | Signet's CI tests 22 and 24; `--target node` needs 22.18+ |
| Bun | 1.3+ | `full` runs its API, tests and CI under Bun, whatever installs it |
| React | 19+ | Peer of `signet-ui` |
| Tailwind CSS | 4+ | The themes are Tailwind v4 CSS |
## Add to an existing React app [#add-to-an-existing-react-app]
### Install [#install]
```bash
npm i @dapplelight/signet-ui @dapplelight/signet-tokens
npm i @dapplelight/signet-lib
npm i @base-ui/react class-variance-authority clsx
npm i tailwind-merge lucide-react
```
```bash
pnpm add @dapplelight/signet-ui @dapplelight/signet-tokens
pnpm add @dapplelight/signet-lib
pnpm add @base-ui/react class-variance-authority clsx
pnpm add tailwind-merge lucide-react
```
```bash
bun add @dapplelight/signet-ui @dapplelight/signet-tokens
bun add @dapplelight/signet-lib
bun add @base-ui/react class-variance-authority clsx
bun add tailwind-merge lucide-react
```
### Import the theme [#import-the-theme]
```css title="src/app.css"
@import "tailwindcss";
@import "@dapplelight/signet-tokens/editorial.css";
@import "@dapplelight/signet-tokens/base.css";
/* Tailwind does not scan node_modules, and
@dapplelight/signet-ui ships compiled JS whose class names
must be seen or every component renders unstyled. The theme
cannot declare this: a package does not know where it is
installed. Must come after the @import rules: CSS requires
imports first. */
@source "../node_modules/@dapplelight/signet-ui/dist";
```
Other themes: [Themes](/docs/packages/tokens/themes). Your own: [Make a Theme](/docs/guides/add-theme).
### Add the Tailwind plugin [#add-the-tailwind-plugin]
```bash
npm i -D tailwindcss @tailwindcss/vite
```
```bash
pnpm add -D tailwindcss @tailwindcss/vite
```
```bash
bun add -D tailwindcss @tailwindcss/vite
```
```ts title="vite.config.ts"
import tailwindcss from "@tailwindcss/vite"
import react from "@vitejs/plugin-react"
import { defineConfig } from "vite"
export default defineConfig({ plugins: [react(), tailwindcss()] })
```
### Wrap the app in ThemeProvider [#wrap-the-app-in-themeprovider]
```tsx title="src/main.tsx"
import { ThemeProvider } from
"@dapplelight/signet-ui/components/theme-provider"
import { StrictMode } from "react"
import { createRoot } from "react-dom/client"
import { App } from "./App"
import "./app.css"
createRoot(document.getElementById("root")!).render(
,
)
```
### Render a Button [#render-a-button]
```tsx title="src/App.tsx"
import { Button } from "@dapplelight/signet-ui/components/button"
export function App() {
return
}
```
# Project structure (/docs/project-structure)
| Path | Purpose |
| --- | --- |
| `api/` | `full`: Hono API, env, plans, services, SQLite schema |
| `api/app.ts` | `full`: every route, mounted under `/api` |
| `drizzle/` | `full`: SQL migrations |
| `src/` | The web app: Vite, React, TanStack Router |
| `src/routes/` | One file per page |
| `src/lib/api.ts` | The typed client for the API |
| `test/`, `e2e/` | API tests and the Playwright smoke test |
| `.github/workflows/` | CI: lint, typecheck, test |
The generated env file gets fresh `SESSION_SECRET` and `OTP_SECRET` values in the `full` template. Templates ship `_gitignore` and `_github`, renamed to `.gitignore` and `.github` on scaffold.
Other templates: [Flags and templates](/docs/packages/create-signet-app/flags).
# Abuse Screens (/docs/components/abuse-screens)
```tsx
import { CaptchaWidget } from "@dapplelight/signet-ui/screens/abuse-screens"
import { useState } from "react"
export function CaptchaWidgetDemo() {
const [token, setToken] = useState(null)
return (
{token ?? "no token yet"}
)
}
```
## Installation [#installation]
```bash
npm i @dapplelight/signet-ui
```
```bash
pnpm add @dapplelight/signet-ui
```
```bash
bun add @dapplelight/signet-ui
```
```bash
bun path/to/signet/packages/cli/src/index.ts add abuse-screens
```
## Usage [#usage]
```tsx
import { CaptchaWidget, AiSpendAdmin } from "@dapplelight/signet-ui/screens/abuse-screens"
import { useState } from "react"
const [token, setToken] = useState(null)
```
The demo uses `provider="test"`, so no script is loaded. Switch to `turnstile` or `hcaptcha` with a site key in production.
## Examples [#examples]
### CaptchaWidget [#captchawidget]
```tsx
import { CaptchaWidget } from "@dapplelight/signet-ui/screens/abuse-screens"
import { useState } from "react"
export function CaptchaWidgetDemo() {
const [token, setToken] = useState(null)
return (
)
}
```
### ApiKeyReveal [#apikeyreveal]
```tsx
import { ApiKeyReveal } from "@dapplelight/signet-ui/screens/account-screens"
export function ApiKeyRevealDemo() {
return (
)
}
```
### AccountSection and AccountSectionHeader [#accountsection-and-accountsectionheader]
```tsx
import { Button } from "@dapplelight/signet-ui/components/button"
import { AccountSection, AccountSectionHeader } from "@dapplelight/signet-ui/screens/account-screens"
export function AccountSectionDemo() {
return (
Edit} />
Weekly digest and billing emails go to asha@acme.example.
)
}
```
## API Reference [#api-reference]
### ProfileCard [#profilecard-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `profile` | `Profile` | — | `name`, `email`, `phone`, `image`. |
| `onSave` | `(patch: { name: string }) => unknown` | — | Save a new name. Without it the name is read-only. |
| `action` | `ReactNode` | — | Shown beside the details, e.g. a Change photo button. |
| `labels` | `Partial` | — | Every string, in English by default. Spread `DEFAULT_ACCOUNT_LABELS` to translate. |
| `className` | `string` | — | Class for the root. |
| `classNames` | `Partial>` | — | Classes per part. |
### SessionsList [#sessionslist-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `sessions` | `readonly SessionRow[]` | — | Rows of `sessionRoutes` GET; `current` marks this device. |
| `onRevoke` | `(session: SessionRow) => unknown` | — | Sign out one device. |
| `onRevokeOthers` | `() => unknown` | — | Sign out everywhere else. Confirms first. |
| `locale` | `string` | `browser` | For relative times. |
| `labels` | `Partial` | — | Every string, in English by default. Spread `DEFAULT_ACCOUNT_LABELS` to translate. |
| `classNames` | `Partial>` | — | Classes per part. |
### SessionItem [#sessionitem-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `session` | `SessionRow` | — | The device row. |
| `onRevoke` | `(session: SessionRow) => unknown` | — | Shows a sign-out button. |
| `locale` | `string` | `browser` | For relative times. |
| `labels` | `Partial` | — | Every string, in English by default. Spread `DEFAULT_ACCOUNT_LABELS` to translate. |
### ApiKeysManager [#apikeysmanager-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `keys` | `readonly ApiKeyRow[]` | — | Keys without their secrets. |
| `onCreate` | `(input: { name: string }) => Promise<{ token: string }> \| { token: string }` | — | Mint a key. The token is shown once, then dropped. |
| `onRevoke` | `(key: ApiKeyRow) => unknown` | — | Revoke a key. Confirms first. |
| `locale` | `string` | `browser` | For relative times. |
| `labels` | `Partial` | — | Every string, in English by default. Spread `DEFAULT_ACCOUNT_LABELS` to translate. |
| `classNames` | `Partial>` | — | Classes per part. |
### ApiKeyReveal [#apikeyreveal-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `token` | `string` | — | The new key: read-only, selected on focus, with a copy button. |
| `labels` | `Partial` | — | Every string, in English by default. Spread `DEFAULT_ACCOUNT_LABELS` to translate. |
### AccountSection [#accountsection]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `render` | `ReactElement \| (props, state) => ReactElement` | — | Swaps the `` element. |
| `className` | `string` | — | Merged over the card styles. |
### AccountSectionHeader [#accountsectionheader]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `ReactNode` | — | The section heading. |
| `action` | `ReactNode` | — | Shown on the right. |
| `id` | `string` | — | Id of the heading, for `aria-labelledby`. |
# Action Row (/docs/components/action-row)
```tsx
import { ActionRow } from "@dapplelight/signet-ui/components/action-row"
import { Button } from "@dapplelight/signet-ui/components/button"
import { GitMergeIcon } from "lucide-react"
export function Demo() {
return (
}
title="Merge PR #482"
description="CI passed and two people approved. Merging adds 3 commits to main."
actions={
<>
>
}
/>
)
}
```
## Installation [#installation]
```bash
npm i @dapplelight/signet-ui
```
```bash
pnpm add @dapplelight/signet-ui
```
```bash
bun add @dapplelight/signet-ui
```
```bash
bun path/to/signet/packages/cli/src/index.ts add action-row
```
## Usage [#usage]
```tsx
import { ActionRow } from "@dapplelight/signet-ui/components/action-row"
Approve} />
```
On a screen narrower than `sm` the buttons move under the text, full width, and every Signet `Button` in the row is at least 44px tall. The row is a `group` named by its title. Keyboard focus is the Button's own ring.
## Examples [#examples]
### Answer a question [#answer-a-question]
```tsx
import { ActionRow } from "@dapplelight/signet-ui/components/action-row"
import { Button } from "@dapplelight/signet-ui/components/button"
import { MessageCircleQuestionIcon } from "lucide-react"
}
title="Which database should the new service use?"
description="The agent paused the setup and is waiting for your pick."
actions={
<>
>
}
/>
```
### Approve a deploy [#approve-a-deploy]
```tsx
import { ActionRow } from "@dapplelight/signet-ui/components/action-row"
import { Button } from "@dapplelight/signet-ui/components/button"
import { RocketIcon } from "lucide-react"
}
title="Approve deploy to production"
description="Build 9f3c2e1 failed one smoke test in staging. Approving ships it anyway."
actions={
<>
>
}
/>
```
## Customising [#customising]
Five levels, use the lowest that does the job.
1. **Tokens.** The row reads `--color-bg-surface`, `--color-border-subtle`, `--color-primary` (ask) and `--color-accent-amber` (warn), plus `--radius-xl`. A theme changes it everywhere.
2. **Props and text.** `tone` (`neutral`, `ask`, `warn`), `icon`, `title`, `description`, `actions`. Every string is yours; there is no built-in copy. `warn` is amber, never red: red means destructive.
3. **className and data-\* hooks.** `className` and any `data-*` or `aria-*` prop go on the root. `classNames={{ icon, body, title, description, actions }}` styles one part. Style from CSS with `[data-slot=action-row]`, `[data-tone=warn]` and `[data-slot=action-row-title]`.
4. **Parts.** Build your own layout from `ActionRowRoot`, `ActionRowIcon`, `ActionRowBody`, `ActionRowTitle`, `ActionRowDescription` and `ActionRowActions`.
5. **Copy-in.** `signet add action-row` copies the file into your app to edit.
```tsx
import {
ActionRowActions,
ActionRowBody,
ActionRowDescription,
ActionRowRoot,
ActionRowTitle,
} from "@dapplelight/signet-ui/components/action-row"
Approve deployBuild 9f3c2e1 is ready.
```
## API Reference [#api-reference]
### ActionRow [#actionrow]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| tone | `"neutral" \| "ask" \| "warn"` | `"neutral"` | `ask`: the app needs an answer. `warn`: needs a look, amber. |
| icon | `ReactNode` | - | Leading icon. Decorative, hidden from screen readers. |
| title | `ReactNode` | - | What waits on the user. |
| description | `ReactNode` | - | One plain sentence under the title. |
| actions | `ReactNode` | - | The buttons. Stack under the text on narrow screens. |
| classNames | `{ icon?; body?; title?; description?; actions? }` | - | Class per part. |
# Admin Screens (/docs/components/admin-screens)
```tsx
import { createAdminApi, AdminScreen } from "@dapplelight/signet-ui/screens/admin-screens"
const api = createAdminApi({ baseUrl: "/admin" })
export function AdminScreenDemo() {
return
}
```
## Installation [#installation]
```bash
npm i @dapplelight/signet-ui
```
```bash
pnpm add @dapplelight/signet-ui
```
```bash
bun add @dapplelight/signet-ui
```
```bash
bun path/to/signet/packages/cli/src/index.ts add admin-screens
```
## Usage [#usage]
```tsx
import {
AdminHeader,
AdminMain,
AdminNav,
AdminPager,
AdminPanel,
AdminScreen,
AdminTable,
AdminToolbar,
createAdminApi,
} from "@dapplelight/signet-ui/screens/admin-screens"
```
The demos run on an in-memory `AdminApi`; in an app, use `createAdminApi({ baseUrl })` against signet-server's `adminRoutes`. Parts other than `AdminPanel` must sit inside it.
## Examples [#examples]
### AdminScreen [#adminscreen]
```tsx
import { createAdminApi, AdminScreen } from "@dapplelight/signet-ui/screens/admin-screens"
const api = createAdminApi({ baseUrl: "/admin" })
export function AdminScreenDemo() {
return
}
```
### AdminPanel [#adminpanel]
```tsx
import { createAdminApi, AdminHeader, AdminMain, AdminNav, AdminPager, AdminPanel, AdminTable, AdminToolbar } from "@dapplelight/signet-ui/screens/admin-screens"
const api = createAdminApi({ baseUrl: "/admin" })
export function AdminPanelDemo() {
return (
)
}
```
### AdminToolbar [#admintoolbar]
```tsx
import { createAdminApi, AdminPanel, AdminToolbar } from "@dapplelight/signet-ui/screens/admin-screens"
const api = createAdminApi({ baseUrl: "/admin" })
export function AdminToolbarDemo() {
return (
)
}
```
### AdminFilterButton [#adminfilterbutton]
```tsx
import { createAdminApi, AdminFilterButton, AdminPanel } from "@dapplelight/signet-ui/screens/admin-screens"
const api = createAdminApi({ baseUrl: "/admin" })
export function AdminFilterButtonDemo() {
return (
)
}
```
### AdminRowActions [#adminrowactions]
```tsx
import { createAdminApi, AdminPanel, AdminRowActions, useAdmin } from "@dapplelight/signet-ui/screens/admin-screens"
const api = createAdminApi({ baseUrl: "/admin" })
function FirstRowActions() {
const { page } = useAdmin()
const row = page.rows[0]
return row ? : null
}
export function AdminRowActionsDemo() {
return (
)
}
```
### AdminRecordForm [#adminrecordform]
```tsx
import { createAdminApi, AdminPanel, AdminRecordForm } from "@dapplelight/signet-ui/screens/admin-screens"
const api = createAdminApi({ baseUrl: "/admin" })
export function AdminRecordFormDemo() {
return (
)
}
```
### AdminAuditTrail [#adminaudittrail]
```tsx
import { createAdminApi, AdminAuditTrail, AdminPanel } from "@dapplelight/signet-ui/screens/admin-screens"
const api = createAdminApi({ baseUrl: "/admin" })
export function AdminAuditTrailDemo() {
return (
)
}
```
### AdminRecordSheet [#adminrecordsheet]
```tsx
import { Button } from "@dapplelight/signet-ui/components/button"
import { AdminPanel, AdminRecordSheet, type AdminRecordTarget, createAdminApi } from "@dapplelight/signet-ui/screens/admin-screens"
import { useState } from "react"
const api = createAdminApi({ baseUrl: "/admin" })
export function AdminRecordSheetDemo() {
const [record, setRecord] = useState(null)
return (
)
}
```
## API Reference [#api-reference]
### AdminScreen [#adminscreen-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `api` | `AdminApi` | — | What the panel calls. `createAdminApi` implements it over HTTP. |
| `meta` | `AdminMeta` | — | Metadata you already have; otherwise `api.meta()` is fetched. |
| `table` | `string` | — | The open table (controlled). |
| `defaultTable` | `string` | `first listable table` | Initial table. |
| `onTableChange` | `(table: string) => void` | — | Called when the table changes. |
| `record` | `AdminRecordTarget` | — | The open record (controlled): `{ id }`, `{ id: null }` for a new row, or `null`. |
| `defaultRecord` | `AdminRecordTarget` | `null` | Initial record. |
| `onRecordChange` | `(record: AdminRecordTarget) => void` | — | Called when a record opens or closes. |
| `pageSize` | `number` | `25` | Rows per page. |
| `labels` | `Partial` | — | Every string, in English by default. Spread `DEFAULT_ADMIN_LABELS` to translate. |
| `renderCell` | `(args: { value; column; row }) => ReactNode` | — | Replaces a cell's rendering. Return undefined to keep the default. |
| `renderField` | `(args: { column; value; onChange; id }) => ReactNode` | — | Replaces one field's control in the form. |
| `classNames` | `Partial>` | — | Classes per part. |
| `render` | `ReactElement` | — | Replaces the root element. |
### AdminPanel [#adminpanel-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `api` | `AdminApi` | — | What the panel calls. |
| `meta` | `AdminMeta` | — | Metadata you already have. |
| `table, defaultTable, onTableChange` | `string` | — | The open table, controlled or not. |
| `record, defaultRecord, onRecordChange` | `AdminRecordTarget` | — | The open record, controlled or not. |
| `pageSize` | `number` | `25` | Rows per page. |
| `labels` | `Partial` | — | Every string. |
| `children` | `ReactNode` | — | The parts, rendered inside a grid. Use `useAdmin()` in a custom part for the state. |
### AdminRecordForm [#adminrecordform-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `row` | `AdminRow` | — | The row being edited. Absent means create. |
| `onSaved` | `(row: AdminRow) => void` | — | Called with the saved row. |
| `renderField` | `(args: { column; value; onChange; id }) => ReactNode` | — | Replaces one field's control. |
| `className` | `string` | — | Class for the form. |
### AdminAuditTrail [#adminaudittrail-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `table` | `string` | — | Table name of the row. |
| `id` | `string` | — | Row id. |
| `className` | `string` | — | Class for the list. |
### AdminRowActions [#adminrowactions-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `row` | `AdminRow` | — | The row the menu acts on. |
| `className` | `string` | — | Class for the trigger. |
### AdminRecordSheet [#adminrecordsheet-1]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `renderField` | `(args: { column; value; onChange; id }) => ReactNode` | — | Replaces one field's control in the form. |
| `className` | `string` | — | Class for the sheet. |
### AdminTable [#admintable]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `renderCell` | `(args: { value; column; row }) => ReactNode` | — | Replaces a cell's rendering. |
| `render` | `ReactElement` | — | Replaces the root element. |
### AdminNav, AdminMain, AdminHeader, AdminToolbar, AdminPager, AdminFilterButton [#adminnav-adminmain-adminheader-admintoolbar-adminpager-adminfilterbutton]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | — | Merged over the defaults. Except AdminFilterButton, each also takes `render`. |
# Alert Dialog (/docs/components/alert-dialog)
```tsx
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@dapplelight/signet-ui/components/alert-dialog"
import { Button } from "@dapplelight/signet-ui/components/button"
export function Demo() {
return (
}>Delete project
Delete "Q4 Planning"?
This permanently removes the project and its 38 tasks. This cannot be undone.
CancelDelete
)
}
```
## Installation [#installation]
```bash
npm i @dapplelight/signet-ui
```
```bash
pnpm add @dapplelight/signet-ui
```
```bash
bun add @dapplelight/signet-ui
```
```bash
bun path/to/signet/packages/cli/src/index.ts add alert-dialog
```
## Usage [#usage]
```tsx
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@dapplelight/signet-ui/components/alert-dialog"
import { Button } from "@dapplelight/signet-ui/components/button"
}>Open
Are you sure?This cannot be undone.CancelContinue
```
## Examples [#examples]
### Controlled [#controlled]
```tsx
import {
AlertDialog,
AlertDialogAction,
AlertDialogCancel,
AlertDialogContent,
AlertDialogDescription,
AlertDialogFooter,
AlertDialogHeader,
AlertDialogTitle,
AlertDialogTrigger,
} from "@dapplelight/signet-ui/components/alert-dialog"
import { Button } from "@dapplelight/signet-ui/components/button"
import { useState } from "react"
const [open, setOpen] = useState(false)
const [status, setStatus] = useState("Subscription active")
{
setOpen(next)
if (!next && details.returnValue === "confirm") setStatus("Subscription cancelled")
}}
>
}>Cancel subscription
Cancel your Pro plan?You keep access until 30 Nov 2026.Keep planCancel plan
```
### Async action [#async-action]
```tsx
import { AlertDialogAction } from "@dapplelight/signet-ui/components/alert-dialog"
import { refundOrders } from "./actions"
{
await refundOrders()
}}
>
Refund
```
## API Reference [#api-reference]
### AlertDialog [#alertdialog]
Takes the options of the underlying alert dialog. It is always modal and an outside press never closes it.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `open` | `boolean` | - | Controlled open state. |
| `defaultOpen` | `boolean` | `false` | Initial state when uncontrolled. |
| `onOpenChange` | `(open, details) => void` | - | `details.reason` says why, `details.returnValue` is the `value` of the button that closed it (`"confirm"` or `"cancel"`). |
| `dismissible` | `boolean` | `true` | Whether Escape and Android's back gesture can close it. An outside press never does. |
| `onDismissAttempt` | `(details) => void` | - | Runs when a dismissal was refused. |
| `onOpenChangeComplete` | `(open: boolean) => void` | - | Runs after the open or close animation ends. |
| `pendingAnnouncement` | `string` | `"Loading"` | What screen readers hear once an action has been pending for a second. |
| `persistentElements` | `(Element \| string)[]` | - | Elements that stay usable while the page is inert. |
| `controller` | `AlertDialogController` | - | Open, close and inspect it from anywhere (`createAlertDialogController()`). |
### AlertDialogTrigger [#alertdialogtrigger]
Renders a `button`. Pass `render` to use your own element, such as a `Button`. Also takes `payload`, `shortcut` and `disabled`.
### AlertDialogContent [#alertdialogcontent]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | - | Merged onto the dialog surface. |
| `backdropClassName` | `string` | - | Merged onto the backdrop. |
| `initialFocus` | `"auto" \| "content" \| "none" \| selector \| element \| function` | `"auto"` | Where focus goes on open. `"auto"` picks the first Close part, the safe answer. |
| `finalFocus` | `"trigger" \| "none" \| selector \| element \| function` | `"trigger"` | Where focus returns on close. |
| `keepMounted` | `boolean` | `false` | Keep it in the page, hidden, while closed. |
### AlertDialogHeader, AlertDialogFooter [#alertdialogheader-alertdialogfooter]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` | - | Merged last. |
Plus every `div` prop. The footer stacks on phones and right-aligns from `sm` up.
### AlertDialogTitle, AlertDialogDescription [#alertdialogtitle-alertdialogdescription]
Render an `h2` and a `p`. They name and describe the dialog for screen readers.
### AlertDialogAction [#alertdialogaction]
The agreeing answer. Closes with `returnValue` `"confirm"`.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | `default` \| `outline` \| `secondary` \| `ghost` \| `destructive` \| `link` | `default` | Button variant. |
| `size` | Button size | - | Button size. |
| `action` | `(event, details) => unknown` | - | Runs before closing. Return a Promise to keep the dialog open and the button pending until it settles. |
| `value` | `string` | `"confirm"` | Reported as `returnValue`. |
### AlertDialogCancel [#alertdialogcancel]
The safe answer. Put it first: it takes focus when the dialog opens. Closes with `returnValue` `"cancel"`.
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `variant` | Button variant | `outline` | Button variant. |
| `size` | Button size | - | Button size. |
| `action` | `(event, details) => unknown` | - | Runs before closing. |
# Alert (/docs/components/alert)
```tsx
import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"
import { InfoIcon } from "lucide-react"
export function Demo() {
return (
Invoice INV-2041 sentAcme Corp was emailed a payment link for $4,200.00.
)
}
```
## Installation [#installation]
```bash
npm i @dapplelight/signet-ui
```
```bash
pnpm add @dapplelight/signet-ui
```
```bash
bun add @dapplelight/signet-ui
```
```bash
bun path/to/signet/packages/cli/src/index.ts add alert
```
## Usage [#usage]
```tsx
import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"
Heads upSomething worth reading.
```
## Examples [#examples]
### Destructive [#destructive]
```tsx
import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"
import { CircleAlertIcon } from "lucide-react"
Payment failedThe card ending 4242 was declined. Update it to keep your plan.
```
### Warning [#warning]
```tsx
import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"
import { AlertTriangleIcon } from "lucide-react"
Usage at 92%You have used 9,200 of 10,000 API calls this month.
```
### Without an icon [#without-an-icon]
```tsx
import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"
Scheduled maintenanceReports will be unavailable on Sunday from 02:00 to 03:00 UTC.
```
## Composition [#composition]
```tsx
import { Alert, AlertDescription, AlertTitle } from "@dapplelight/signet-ui/components/alert"
export function DeployAlerts() {
return (
Deploy succeededproduction · 41s · commit 9f3c2e1Card declinedAsk the customer for another payment method.
)
}
```
## API Reference [#api-reference]
### Alert [#alert]
| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `variant` | `"default" \| "destructive" \| "warning"` | `"default"` | No | Colour of the border, background and icon. |
| `className` | `string` | — | No | Merged last. |
Plus every native [`
`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div) attribute. Renders with `role="alert"`. A direct child `svg` is placed at the start and the text indents past it.
### AlertTitle [#alerttitle]
| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `className` | `string` | — | No | Merged last. |
Plus every native [`
`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Heading_Elements) attribute.
### AlertDescription [#alertdescription]
| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `className` | `string` | — | No | Merged last. |
Plus every native [`
`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/div) attribute.
# Amount (/docs/components/amount)
```tsx
import { Amount } from "@dapplelight/signet-ui/domain/amount"
export function AmountDemo() {
return (
Revenue this month
)
}
```
## Installation [#installation]
```bash
npm i @dapplelight/signet-ui
```
```bash
pnpm add @dapplelight/signet-ui
```
```bash
bun add @dapplelight/signet-ui
```
```bash
bun path/to/signet/packages/cli/src/index.ts add amount
```
## Usage [#usage]
```tsx
import { Amount, formatAmount } from "@dapplelight/signet-ui/domain/amount"
```
## Examples [#examples]
### Compact [#compact]
```tsx
import { Amount } from "@dapplelight/signet-ui/domain/amount"
export function AmountDemo() {
return (
Revenue this month
)
}
```
### Locales [#locales]
```tsx
import { Amount } from "@dapplelight/signet-ui/domain/amount"
export function AmountLocaleDemo() {
return (
)
}
```
### Tone [#tone]
```tsx
import { Amount } from "@dapplelight/signet-ui/domain/amount"
export function AmountToneDemo() {
return (
)
}
```
### Minor units [#minor-units]
```tsx
import { Amount } from "@dapplelight/signet-ui/domain/amount"
export function AmountMinorUnitsDemo() {
return (
)
}
```
### Lakh and crore [#lakh-and-crore]
```tsx
import { Amount } from "@dapplelight/signet-ui/domain/amount"
export function AmountCompactDemo() {
return (
)
}
```
### Parts [#parts]
```tsx
import { Amount } from "@dapplelight/signet-ui/domain/amount"
export function AmountPartsDemo() {
return (
)
}
```
## API Reference [#api-reference]
### Amount [#amount]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `number \| string \| bigint` | — | The amount. Use a bigint for exact minor units. |
| `currency` | `string` | `"INR"` | ISO 4217 code. |
| `locale` | `string` | `"en-IN"` | Indian locales group by lakh and crore. |
| `minorUnits` | `boolean` | `false` | `value` is in paise or cents: 12345 INR is ₹123.45. |
| `notation` | `"standard" \| "whole" \| "compact"` | `"standard"` | Standard shows the currency's decimals, whole none, compact shortens (₹12.5L, $1.3M). |
| `decimals` | `number` | — | Overrides the number of decimals. In compact notation it is the maximum (default 1). |
| `tone` | `"credit" \| "debit" \| "transfer" \| "auto"` | — | Colour from the theme's money slots. `auto` picks credit or debit from the sign. |
| `signDisplay` | `Intl.NumberFormatOptions["signDisplay"]` | `"auto"` | Defaults to `exceptZero` when `tone` is `auto`, so the sign is never shown by colour alone. |
| `classNames` | `Partial>` | — | Classes per part: `sign`, `currency`, `integer`, `fraction`, `compact`. |
| `render` | `React.ReactElement` | — | Replaces the `` element, keeping props and parts. |
| `title` | `string` | — | Compact amounts default to the full amount on hover. |
### formatAmount [#formatamount]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `value` | `AmountValue` | — | The amount to format. |
| `options` | `Pick` | `{}` | Same options as the component. Returns `{ parts, major, sign }`, for table cells and chart labels. |
# Answer Headline (/docs/components/answer-headline)
```tsx
import { AnswerHeadline, type AnswerHeadlineData } from "@dapplelight/signet-ui/components/answer-headline"
const onTrack: AnswerHeadlineData = {
question: "Are we on track this month?",
sentence: ["Yes. Revenue is ", { value: 48200 }, ", ", { value: 12 }, "% ahead of plan."],
detail: ["Last month closed at ", { value: 43000 }, "."],
tone: "good",
}
export function Demo() {
return n.toLocaleString()} />
}
```
## Installation [#installation]
```bash
npm i @dapplelight/signet-ui
```
```bash
pnpm add @dapplelight/signet-ui
```
```bash
bun add @dapplelight/signet-ui
```
```bash
bun path/to/signet/packages/cli/src/index.ts add answer-headline
```
## Usage [#usage]
```tsx
import { AnswerHeadline } from "@dapplelight/signet-ui/components/answer-headline"
```
## Examples [#examples]
### Warn tone [#warn-tone]
```tsx
import {
AnswerHeadline,
AnswerHeadlineData,
} from "@dapplelight/signet-ui/components/answer-headline"
const atRisk: AnswerHeadlineData = {
question: "Can we cover payroll?",
sentence: ["Cash covers payroll for ", { value: 5 }, " more weeks."],
detail: ["Runway shortens if the Acme renewal slips past 30 Nov."],
tone: "warn",
}
```
### Neutral tone [#neutral-tone]
```tsx
import { AnswerHeadline } from "@dapplelight/signet-ui/components/answer-headline"
```
### Custom value rendering [#custom-value-rendering]
```tsx
import { AnswerHeadline } from "@dapplelight/signet-ui/components/answer-headline"
import { onTrack } from "./headlines"
`$${n.toLocaleString()}`}
/>
```
### With controls [#with-controls]
```tsx
import { AnswerHeadline } from "@dapplelight/signet-ui/components/answer-headline"
import { Button } from "@dapplelight/signet-ui/components/button"
import { plain } from "./headlines"
```
## API Reference [#api-reference]
### AnswerHeadline [#answerheadline]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `headline` | `AnswerHeadlineData` | required | The question, sentence, optional detail and tone. |
| `renderValue` | `(value: number) => ReactNode` | locale number, `••••••` when masked | Renders each `{ value }` segment. A custom one must mask itself. |
| `className` | `string` | - | Merged last. |
| `children` | `ReactNode` | - | Extra controls under the sentence, such as period pills or a link. |
### AnswerHeadlineData [#answerheadlinedata]
| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `question` | `string` | required | Small muted line above the sentence. Also the section's `aria-label`. |
| `sentence` | `AnswerSegment[]` | required | Text, or `{ value: number }` rendered bold by `renderValue`. |
| `detail` | `AnswerSegment[]` | - | Optional supporting line. |
| `tone` | `neutral` \| `good` \| `warn` | required | `warn` renders amber. Never red, which means destructive. |
Under the privacy mask, percentages in the text become `••%`.
### answerText [#answertext]
`answerText(segments, format?)` returns the plain text of a sentence for aria-labels, notifications and tests. `format` defaults to the locale number format.
# API Screens (/docs/components/api-screens)
```tsx
import { ApiReference, type ApiSpec } from "@dapplelight/signet-ui/screens/api-screens"
const spec: ApiSpec = {
info: { title: "Orders API", version: "1.0.0" },
components: { securitySchemes: { bearer: { type: "http", scheme: "bearer" } } },
paths: {
"/orders": {
get: {
operationId: "listOrders",
summary: "List orders",
tags: ["Orders"],
security: [{ bearer: [] }],
parameters: [
{ name: "status", in: "query", description: "Filter by status", schema: { type: "string", enum: ["open", "paid", "refunded"] } },
{ name: "limit", in: "query", schema: { type: "integer" } },
],
responses: { "200": { description: "A page of orders" } },
},
post: {
operationId: "createOrder",
summary: "Create an order",
tags: ["Orders"],
security: [{ bearer: [] }],
requestBody: {
content: {
"application/json": {
schema: { type: "object", properties: { customerId: { type: "string" }, amount: { type: "integer" } }, required: ["customerId", "amount"] },
},
},
},
responses: { "201": { description: "The new order" }, "422": { description: "Validation failed" } },
},
},
"/health": {
get: { operationId: "health", summary: "Health check", tags: ["Status"], security: [], responses: { "200": { description: "OK" } } },
},
},
}
export function ApiReferenceDemo() {
return (