Skip to Content
UI

Screens

Ready-made app screens: auth, account, billing, admin, orgs, notifications and more.

Usage

import { AuthScreen } from "@dapplelight/signet-ui/screens/auth-screens"

export function SignIn() {
  return (
    <AuthScreen
      onRequestCode={({ channel, to, mode }) =>
        fetch("/api/auth/code", { method: "POST", body: JSON.stringify({ channel, to, mode }) })
      }
      onVerify={({ to, code }) =>
        fetch("/api/auth/verify", { method: "POST", body: JSON.stringify({ to, code }) })
      }
    />
  )
}

Every screen is plain data in, callbacks out: no fetch or router inside. A callback that returns a Promise keeps its button pending; one that throws shows its message. Each module also exports DEFAULT_*_LABELS and takes a labels prop to translate or reword any string.

API

Each module is its own path, @dapplelight/signet-ui/screens/<name>. Shapes of the data props match signet-server and signet-db results (or their JSON).

auth-screens

Sign in and up with a one-time code by email or phone, plus OAuth buttons.

ExportWhat it does
AuthScreenThe whole sign-in / sign-up flow.
VerifyCodeScreen, VerifyCodeFormThe code step on its own.
CodeRequestForm, OAuthButtonsThe first-step form and the provider buttons.
SessionExpiredScreen"Session expired" with a sign-in action.
AuthCard, AuthHeader, AuthDivider, AuthErrorLayout parts.
DEFAULT_AUTH_LABELSDefault strings.
TypesAuthMode, AuthChannel, OAuthProvider, CodeRequest, AuthLabels, plus *Props for each component.

account-screens

ExportWhat it does
ProfileCardName, email, phone, avatar; optional name save.
SessionsList, SessionItem"Your devices" with sign out and sign out everywhere else.
ApiKeysManager, ApiKeyRevealList, create (token shown once) and revoke API keys.
AccountSection, AccountSectionHeaderLayout parts.
DEFAULT_ACCOUNT_LABELSDefault strings.
TypesWhen, SessionRow, ApiKeyRow, Profile, AccountLabels, ProfileCardProps, SessionsListProps, SessionItemProps, ApiKeysManagerProps.

billing-screens

ExportWhat it does
BillingScreenThe billing page: current plan, usage, plans, invoices, wallet.
PaywallHeadline, plan picker, and Restore in a store build.
PlanPickerPlan cards as a radio group with an interval switch.
CurrentPlanCardPlan, status, renewal or end date, where it was bought.
UsageMetersOne bar per limit; amber at 75%, red at 90%.
InvoiceListInvoices newest first, each linking to its GST HTML invoice.
WalletCardBalance with optional top-up.
RestorePurchasesButtonRestore App Store or Google Play purchases.
plansFromEntitlements(...)Billing plans from a definePlans object plus names and prices.
formatMoney(...)Minor units to a localised amount: 49900 INR is ₹499.
DEFAULT_BILLING_LABELSDefault strings.
TypesBillingSource, BillingInterval, BillingPrice, BillingPlan, BillingStatus, BillingSubscription, BillingUsage, BillingInvoice, BillingLabels, PlanPickerProps, RestorePurchasesButtonProps, CurrentPlanCardProps, UsageMetersProps, InvoiceListProps, WalletCardProps, PaywallProps, BillingScreenProps.

monetisation-screens

ExportWhat it does
RemotePaywallThe paywall the server configured: copy, plans, highlight, trial text.
CustomerCenterSelf-serve plan management: cancel with retention offer, refund, support.
CustomerTimelineOne customer's billing history across stores and web (admin).
PromotionalGrantFormGrant a plan for some days (admin).
plansFromOffering(...)Billing plans for one source from an offering.
DEFAULT_MONETISATION_LABELSDefault strings.
TypesRemoteOffer, RemoteProduct, RemotePaywallConfig, RemoteOffering, RetentionOfferView, CustomerOverview, CustomerTimelineEntry, CustomerTimelineTotal, MonetisationLabels, RemotePaywallProps, CustomerCenterProps, CustomerTimelineProps, PromotionalGrantFormProps.

subscription-charts

Needs the optional peer recharts, so it is never in the barrel.

ExportWhat it does
SubscriptionChartsMRR, subscribers, revenue, churn and paywall conversion, with filters, saved audiences and CSV link.
DEFAULT_CHART_LABELSDefault strings.
TypesChartDayView, ChartResultView, ChartFilterView, ChartAudienceView, ChartLabels, SubscriptionChartsProps.

cost-dashboard

AI cost for the admin: a spend-over-time chart with what the cache saved, spend by model, top spenders (subject hashes, exactly as the server gives them), and global cap usage bars. Needs the optional peer recharts, so it is never in the barrel. Money is millionths of a USD; anything above zero but under one cent shows <$0.01. The caps bar is the primary colour under 80%, amber from 80%, red at 100% and over, and always shows its percent as text; a null cap reads "No cap".

Feed it the JSON of signet-server's observabilityAdminRoutes (series, models, top) and, for the caps card, signet-db's usage("global"). Pass fetcher(days) and the screen loads, reloads on a new range and retries itself; or pass data, loading, error, onRetry and onDaysChange and own the state.

import { CostDashboard } from "@dapplelight/signet-ui/screens/cost-dashboard"

const get = (path: string, days: number) =>
  fetch(`/api/admin/observability/cost/${path}?days=${days}`).then((r) => r.json())

<CostDashboard
  fetcher={async (days) => {
    const [s, m, t, caps] = await Promise.all([
      get("series", days), get("by-model", days), get("top", days), fetch("/api/admin/ai-caps").then((r) => r.json()),
    ])
    return { series: s.series, models: m.models, top: t.top, caps }
  }}
/>
ExportWhat it does
CostDashboardRange select, spend / cache-saved / top-model tiles, and the four cards. Root data-slot="cost-dashboard"; cards chart-spend, cost-models, cost-top, cost-caps; rows carry data-model, data-subject or data-period.
DEFAULT_COST_LABELSDefault strings, plus money(units) (USD).
TypesCostDashboardData, CostSeriesRow, CostModelRow, CostSubjectRow, CostCapUsage, CostLabels, CostDashboardProps.

admin-screens

An admin panel generated from signet-db's defineAdmin metadata and signet-server's adminRoutes.

ExportWhat it does
AdminScreenThe whole panel, drop in.
createAdminApi(options?)AdminApi over fetch for adminRoutes.
AdminApiErrorA failed call; fieldErrors maps column key to messages.
AdminPanel, useAdmin()State holder and its hook, for custom layouts.
AdminNav, AdminMain, AdminHeader, AdminToolbar, AdminFilterButtonLayout parts.
AdminTable, AdminRowActions, AdminPagerRows, row menu, cursor paging.
AdminRecordSheet, AdminRecordForm, AdminAuditTrailRecord panel, form built from column types, change history.
DEFAULT_ADMIN_LABELSDefault strings.
TypesAdminApi, AdminApiOptions, AdminColumn, AdminMeta, AdminTableMeta, AdminRow, AdminFilter, AdminFilterOp, AdminOp, AdminListQuery, AdminListResult, AdminRecordTarget, AdminLabels, AdminPanelProps, AdminTableProps, AdminRecordFormProps, AdminRecordSheetProps, AdminScreenProps.

org-screens

ExportWhat it does
OrgSwitcherCurrent org as a button; pick another.
MembersListMembers with roles; change role, remove, revoke invites.
InviteDialogEmail and role in, one-time invite link out.
AcceptInvitePageFull page around InviteAccept.
OrgSettingsName, theme and brand colour with live preview.
DEFAULT_ORG_LABELSDefault strings.
TypesOrgSummary, OrgMember, OrgInvitation, OrgSettingsValue, OrgLabels, OrgSwitcherProps, MembersListProps, InviteDialogProps, AcceptInvitePageProps, OrgSettingsProps.

notification-screens

ExportWhat it does
NotificationInbox, InboxItem, InboxItemBodyIn-app inbox: all or unread, mark read, archive, load more.
NotificationPreferencesOne switch per category and channel.
DEFAULT_NOTIFICATION_LABELSDefault strings.
TypesNotifyChannel, InboxEntry, InboxFilter, ChannelPrefs, PreferenceCategory, NotificationLabels, NotificationInboxProps, InboxItemProps, NotificationPreferencesProps.

privacy-screens

Consent and data requests for India's DPDP Act.

ExportWhat it does
ConsentListOne switch per purpose; withdrawing is as easy as giving.
DataRequestsExport and erasure requests with status; erasure confirms first.
PrivacySectionLayout part.
DEFAULT_PRIVACY_LABELSDefault strings.
TypesConsentRecord, DataRequestRow, ConsentPurpose, PrivacyLabels, ConsentListProps, DataRequestsProps.

collab-screens

ExportWhat it does
CommentThreadsThreads with replies, edit, delete and an @mention composer.
MentionTextareaTextarea with an @ member picker.
CommentBodyA comment body with mentions as chips.
ActivityFeedWhat happened to a record, newest first.
VersionHistory, VersionDiffVersions with a field diff; Restore or undo.
mentionsToText(...), textToMentions(...)Convert between stored @[Name](user:id) and display text.
DEFAULT_COLLAB_LABELSDefault strings.
TypesCollabPerson, CollabComment, CollabThread, CollabFieldChange, CollabTimelineItem, CollabVersion, CollabLabels, MentionTextareaProps, CommentThreadsProps, ActivityFeedProps, VersionHistoryProps.

realtime-screens

Pairs with hooks/use-channel.

ExportWhat it does
AvatarStackWho is viewing.
EditingBadgeWho is editing a field.
TypingIndicator"Asha is typing".
RecordChangedBanner"This record changed, reload?"
DEFAULT_REALTIME_LABELSDefault strings.
TypesPresenceMemberView, RealtimeLabels, AvatarStackProps, EditingBadgeProps, TypingIndicatorProps, RecordChangedBannerProps.

growth-screens

ExportWhat it does
WaitlistJoinEmail box; then the place in line.
InviteAcceptWho invited you to what; Accept or Decline.
ReferralCardCode, copyable link, share, friends joined.
OnboardingChecklistProgress ring and steps.
FeedbackForm, FeedbackWidgetKind, message, stars; widget opens it in a popover.
WhatsNewButton with unseen count; opens latest changes.
DEFAULT_GROWTH_LABELSDefault strings.
TypesGrowthLabels, WaitlistResult, WaitlistJoinProps, InviteDetails, InviteAcceptResult, InviteAcceptProps, ReferralCardProps, OnboardingStep, OnboardingChecklistProps, FeedbackInput, FeedbackFormProps, FeedbackWidgetProps, ChangelogEntry, WhatsNewProps.

experiment-screens

ExportWhat it does
ExperimentList, ExperimentStatusBadgeExperiments with status and goal.
ExperimentResultsPer-variant exposures, conversions, lift, p-value; start, stop, roll out.
ExperimentFormCreate or edit: key, goal event, audience, 2 to 10 variants.
PricingExperimentResultsPricing readout with one-click rollout of the winning offering.
DEFAULT_EXPERIMENT_LABELSDefault strings.
TypesExperimentStatus, ExperimentView, VariantResultView, ExperimentResultsView, OfferingChoice, ExperimentInputView, PricingVariantView, PricingReadoutView, ExperimentLabels, ExperimentListProps, ExperimentResultsProps, ExperimentFormProps, PricingExperimentResultsProps.

funnel-screens

Web-to-app funnels: questions, paywall, checkout, then redemption.

ExportWhat it does
WebFunnelQuestions, remote paywall with URL discount, then email and code.
FunnelQuestionOne question as large toggle buttons.
ExpressCheckoutApple Pay, Google Pay and card via Stripe.
FunnelRedemptionAfter purchase: app link and code to paste.
discountedOffering(...)The offering with valid discounts priced in.
loadScript(...)Load a script once per page.
STRIPE_JS_URLStripe.js URL.
DEFAULT_FUNNEL_LABELSDefault strings.
TypesFunnelQuestionView, FunnelDiscountView, FunnelPageView, FunnelAnswers, FunnelCheckoutRequest, FunnelSessionView, FunnelLabels, FunnelQuestionProps, WebFunnelProps, ExpressCheckoutProps, FunnelRedemptionProps.

status-screens

ExportWhat it does
StatusPagePublic page: overall status, maintenance, components, incidents.
StatusAdminAdmin: maintenance switch, component statuses, incidents.
MaintenanceForm, ComponentStatusList, IncidentForm, IncidentUpdateFormThe admin parts.
DEFAULT_STATUS_LABELS, DEFAULT_STATUS_ADMIN_LABELSDefault strings.
TypesComponentStatus, StatusIncidentView, StatusSummaryView, StatusLabels, StatusAdminLabels, MaintenanceInput, IncidentInput, StatusPageProps, StatusAdminProps, MaintenanceFormProps, ComponentStatusListProps, IncidentFormProps, IncidentUpdateFormProps.

workflow-screens

ExportWhat it does
WorkflowRunTimelineA run: status, what it waits on, every step with retries.
ApprovalInboxCardPending approvals with Approve and Reject.
waitingText(...)One line on what a run is blocked on, or null.
DEFAULT_WORKFLOW_LABELSDefault strings.
TypesRunStatus, WorkflowRunView, WorkflowStepView, WorkflowApprovalView, WorkflowLabels, WorkflowRunTimelineProps, ApprovalInboxCardProps.

api-screens

ExportWhat it does
ApiReferenceEndpoint reference from an OpenAPI 3.1 document, grouped by tag.
WebhookDeliveryLogDeliveries with status filter, response details and redeliver.
DEFAULT_API_LABELSDefault strings.
TypesApiParameter, ApiOperation, ApiSpec, WebhookDeliveryEntry, WebhookStatusFilter, ApiLabels, ApiReferenceProps, WebhookDeliveryLogProps.

abuse-screens

ExportWhat it does
CaptchaWidgetCloudflare Turnstile or hCaptcha; reports a token. provider="test" loads nothing.
AiSpendAdminAdmin AI spend against caps, top spenders, and setting caps.
CAPTCHA_TEST_PASS, CAPTCHA_SCRIPTSThe test-mode token; script URLs per provider.
UNITS_PER_USD, formatUnits(...)Cost units per dollar; $0.0123 from units.
DEFAULT_CAPTCHA_LABELS, DEFAULT_AI_SPEND_LABELSDefault strings.
TypesCaptchaProvider, CaptchaWidgetProps, SpendScope, SpendPeriod, PeriodUsage, SubjectUsage, TopSpender, AiSpendOverview, AiSpendCap, AiSpendCapInput, AiSpendLabels, AiSpendAdminProps.

Examples

Account page

import {
  ApiKeysManager,
  ProfileCard,
  SessionsList,
  type ApiKeyRow,
  type Profile,
  type SessionRow,
} from "@dapplelight/signet-ui/screens/account-screens"
import { api } from "./api"

type AccountData = { me: Profile; sessions: SessionRow[]; keys: ApiKeyRow[] }

export function AccountPage({ me, sessions, keys }: AccountData) {
  return (
    <>
      <ProfileCard profile={me} onSave={({ name }) => api.profile.update({ name })} />
      <SessionsList
        sessions={sessions}
        onRevoke={(s) => api.sessions.revoke(s.id)}
        onRevokeOthers={() => api.sessions.revokeOthers()}
      />
      <ApiKeysManager
        keys={keys}
        onCreate={({ name }) => api.keys.create({ name })} // returns { token }, shown once
        onRevoke={(k) => api.keys.revoke(k.id)}
      />
    </>
  )
}

Billing page

import {
  BillingScreen,
  plansFromEntitlements,
  type BillingInvoice,
  type BillingSubscription,
  type BillingUsage,
} from "@dapplelight/signet-ui/screens/billing-screens"
import { openCustomerPortal, startCheckout } from "./billing"

type BillingData = { subscription: BillingSubscription; usage: BillingUsage[]; invoices: BillingInvoice[] }

export function Billing({ subscription, usage, invoices }: BillingData) {
  return (
    <BillingScreen
      plans={[
        { key: "free", name: "Free" },
        { key: "pro", name: "Pro", badge: "Popular", prices: { month: { amount: 49900, currency: "INR" } } },
      ]}
      subscription={subscription}
      usage={usage}
      invoices={invoices}
      onSubscribe={(plan, interval) => startCheckout(plan.key, interval)}
      onManage={() => openCustomerPortal()}
    />
  )
}

Use plansFromEntitlements to build plans from your definePlans object. See BillingPrice and BillingInterval for the exact price shape.

Admin panel for every table

import { AdminScreen, createAdminApi } from "@dapplelight/signet-ui/screens/admin-screens"

const api = createAdminApi({ baseUrl: "/admin" })

export function Admin() {
  return <AdminScreen api={api} pageSize={50} />
}

createAdminApi options: baseUrl (default "/admin"), fetch, and headers (a function returning extra headers). Cookies are sent.

Notification inbox and preferences

import {
  NotificationInbox,
  NotificationPreferences,
  type ChannelPrefs,
  type InboxEntry,
} from "@dapplelight/signet-ui/screens/notification-screens"
import { api } from "./api"

type NotificationData = { items: InboxEntry[]; prefs: ChannelPrefs }

export function Notifications({ items, prefs }: NotificationData) {
  return (
    <>
      <NotificationInbox
        items={items}
        onMarkRead={(ids) => api.inbox.markRead(ids)}
        onMarkAllRead={() => api.inbox.markAllRead()}
        onArchive={(item) => api.inbox.archive(item.id)}
      />
      <NotificationPreferences
        categories={[
          { id: "invoices", label: "Invoices", description: "Sent, paid and overdue" },
          { id: "security", label: "Security", required: true },
        ]}
        defaultValue={prefs}
        onToggle={(change) => api.prefs.update(change)}
      />
    </>
  )
}

Live presence on a record

import { createRealtimeClient, useRecordChanges, usePresence } from "@dapplelight/signet-ui/hooks/use-channel"
import { AvatarStack, RecordChangedBanner } from "@dapplelight/signet-ui/screens/realtime-screens"

const live = createRealtimeClient({ url: "/realtime" })

export function InvoiceHeader({ id, me }: { id: string; me: string }) {
  const channel = `record:invoices:${id}`
  const members = usePresence(live, channel)
  const { changed, dismiss } = useRecordChanges(live, channel, { selfId: me })
  return (
    <>
      <AvatarStack members={members} selfId={me} />
      <RecordChangedBanner changed={changed} onReload={() => location.reload()} onDismiss={dismiss} />
    </>
  )
}