Skip to Content

Page Blocks

Whole pages you copy into your app and edit: dashboard, list-detail, settings, auth, onboarding, pricing, checkout, empty and error pages.

A block is a page-level layout built only from Signet components. You copy it into your app as source, then change the data, the text and the markup. Agents compose from blocks instead of inventing layouts.

bun path/to/signet/packages/cli/src/index.ts add block analytics-dashboard
Added utils, badge, card, ..., analytics-dashboard (signet-ui 0.3.5).
  wrote blocks/analytics-dashboard/index.tsx
  wrote blocks/analytics-dashboard/sample.ts
  ...

The command copies the block and the components it uses into src/components/signet/, the same way add dialog does (see Own a component's source). The CLI's upgrade command merges later changes into your copy. Run add block with no name to list the blocks.

Every block:

  • takes className and classNames (one entry per part), and sets data-block on its root and data-slot on each part, so you can restyle it from CSS or from a parent;
  • gets every string from a labels prop with defaults, so translating it or renaming a field needs no edit to the file;
  • takes state="ready" | "loading" | "error". Loading shows skeletons in the shape of the real content, and error shows an error state with onRetry;
  • is themed only through tokens, so it follows every theme and light/dark;
  • is one column at 390px with 44px touch targets, and stops growing at max-w-7xl.

The previews below are the showcase pages in an iframe. Use the width buttons to check 390px and 1440px, and the showcase page (link above each preview) for the theme switcher.

Analytics dashboard

A range picker, a row of stats, an area chart and a recent-activity table. It needs recharts, an optional peer of signet-ui.

import { useState } from "react"
import { AnalyticsDashboard } from "@/components/signet/blocks/analytics-dashboard"
import { useDashboard } from "@/lib/use-dashboard"

const [range, setRange] = useState("30d")
const { stats, series, rows, isLoading } = useDashboard(range)

<AnalyticsDashboard
  data={{ stats, series, rows }}
  range={range}
  onRangeChange={setRange}
  state={isLoading ? "loading" : "ready"}
/>

Without data the block shows its empty state: "No data yet". Long names truncate and keep the full text in a title.

List with a detail pane

A searchable, filterable list of 20 rows a page, with the selected row's detail beside it. On a phone, tapping a row opens the detail in a sheet and closing it returns focus to the row. Arrow keys move between rows.

import { ListDetail } from "@/components/signet/blocks/list-detail"
import { ProjectPanel } from "@/components/project-panel"
import { projects } from "@/lib/projects"
import { navigate } from "@/lib/router"

<ListDetail
  items={projects}
  onSelect={(item) => navigate(item.id)}
  renderDetail={(item) => <ProjectPanel project={item} />}
/>

filters replaces the status pills, and pageSize changes the rows per page.

Settings

A General card, a Notifications card and a Danger zone. Each form card has a "Save changes" button that stays disabled until a value changes. Deleting asks the user to type the workspace name first. Mount a <Toaster /> once in your app to show "Changes saved".

import { Settings } from "@/components/signet/blocks/settings"
import { api } from "@/lib/api"
import { workspace } from "@/lib/workspace"

<Settings
  general={{ name: workspace.name, description: workspace.description }}
  onSaveGeneral={(values) => api.updateWorkspace(values)}
  onDelete={() => api.deleteWorkspace()}
/>

A save callback can resolve with { name: "Name is taken" } to show that message under the field.

Auth page

Sign in, sign up and the code step, built from AuthScreen and VerifyCodeScreen. The block holds no back-end code: onRequestCode and onVerify are props, so you wire them to your own API (here with createRpcClient, see Add an API client). OAuth buttons show only when providers is not empty.

import { Auth } from "@/components/signet/blocks/auth-page"
import { api } from "@/lib/api" // createRpcClient(hc<AppType>, { baseUrl: "/" })

<Auth
  mode="sign-in"
  onRequestCode={({ channel, to }) => api.auth.code.$post({ json: { channel, to } })}
  onVerify={({ to, code }) => api.auth.verify.$post({ json: { to, code } })}
  providers={[{ id: "github", label: "GitHub" }]}
  onOAuth={(provider) => (location.href = `/auth/${provider.id}`)}
/>

A callback that throws shows its message in an alert line under the form. Pass step="verify" with to to open on the code step.

Onboarding

A stepper on top and the current step's content in a card below. Steps come in as props. After each step, focus moves to the step heading. "Back" is hidden on the first step, and the last step's button reads "Finish".

import { Onboarding } from "@/components/signet/blocks/onboarding"
import { InviteForm, ProfileForm } from "@/components/forms"
import { api } from "@/lib/api"
import { navigate } from "@/lib/router"

<Onboarding
  steps={[
    { id: "profile", title: "Your profile", content: <ProfileForm /> },
    { id: "team", title: "Invite your team", content: <InviteForm /> },
  ]}
  onNext={(step) => api.saveStep(step.id)}
  onFinish={() => navigate("/")}
  onSkip={() => navigate("/")}
/>

onNext may throw to keep the user on the step. Pass onSkip to show "Skip for now".

Pricing

Plans come from props and show as cards: one column on a phone, up to three on a wide screen. The highlighted plan gets a ring and a "Most popular" badge. A Monthly / Yearly toggle shows when a plan has a year price. With no plans it shows "No plans available".

import { Pricing } from "@/components/signet/blocks/pricing"
import { api } from "@/lib/api"

<Pricing
  currency="USD"
  plans={[
    { id: "free", name: "Free", price: { month: 0 }, features: ["1 project"] },
    {
      id: "pro",
      name: "Pro",
      price: { month: 1200, year: 12000 },
      features: ["Unlimited projects"],
      highlighted: true,
    },
  ]}
  onSelect={(plan, interval) => api.checkout(plan.id, interval)}
/>

Prices are in minor units.

Checkout summary

The line items, then subtotal, discount, tax and total, and a Pay {total} button. Amounts are minor units and go through the same formatMoney as the billing screens. The block holds no payment-provider code: onPay is where you start your own checkout.

import { CheckoutSummary } from "@/components/signet/blocks/checkout-summary"
import { api } from "@/lib/api"
import { cartId } from "@/lib/cart"

<CheckoutSummary
  items={[{ id: "pro", name: "Pro plan", amount: 1200 }]}
  tax={96}
  onPay={() => api.pay(cartId)}
/>

The total passed to onPay is for display only: send the cart or order id and work out the amount on the server, never charge a client-sent total.

An empty items shows "Your cart is empty".

Empty state

A whole empty page: an icon, a title, a description and an action.

import { EmptyPage } from "@/components/signet/blocks/empty-page"
import { openNewProject } from "@/lib/projects"

<EmptyPage onAction={() => openNewProject()} />

The defaults read "No projects yet" and "New project". Pass title, description, icon or action to change them.

404 and 500 pages

code is 404 or 500. A 404 offers "Go home"; a 500 also offers "Try again" when you pass onTryAgain. The number is decoration, hidden from screen readers; the title is the page's h1.

import { ErrorPage } from "@/components/signet/blocks/error-page"

<ErrorPage code={500} homeHref="/" onTryAgain={() => location.reload()} />

Add your own block

A block is a folder packages/ui/src/blocks/<name>/ with an index.tsx, a block.json and a matching ./blocks/<name> entry in signet-ui's exports. block.json lists name, description, files and deps (the signet-ui items it imports). The registry build checks that the file tells the truth and fails when it does not. A block imports only its own files and signet-ui components.

Previews in these docs

Set NEXT_PUBLIC_SHOWCASE_URL when building the docs to the address the showcase is served from. Without it the previews point at the local showcase dev server (bun run dev in apps/showcase).