Components
StatGrid
A compact grid of readouts for a multi-metric glance (a complication cluster). Pure display, tabular numerals. Keep it to 2–4 cells.
Installation
npx @glasskit-ui/cli add stat-gridInstall the SDK (it provides GlassViewport, useDpad and the stylesheet), then copy these files into your project:
npm install @glasskit-ui/react// components/lib/utils.tsexport type ClassValue = string | number | null | undefined | false;/** * Join truthy class names. Dependency-free on purpose: the lens components * style via bespoke semantic classes (no conflicting Tailwind utilities to * de-dupe), so this needs no clsx/tailwind-merge and resolves from anywhere * the registry is vendored. */export function cn(...inputs: ClassValue[]): string { return inputs.filter(Boolean).join(" ");}/** * Accessible name from a free-form `label` prop: the label itself when it's a * plain string, otherwise undefined (a ReactNode can't become an aria-label). */export function stringLabel(label: unknown): string | undefined { return typeof label === "string" ? label : undefined;}// components/glasskit/stat-grid.tsximport type { ReactNode } from "react";import { cn } from "../lib/utils";export type Stat = { label: ReactNode; value: ReactNode; unit?: ReactNode;};/** * <StatGrid> — a compact grid of readouts for a multi-metric glance (a watch * "complication cluster"). Pure display, tabular numerals. Keep it to 2–4 cells * — density past that stops being glanceable. */export function StatGrid({ items, className,}: { items: Stat[]; className?: string;}) { return ( <div className={cn("gk-statgrid", className)}> {items.map((it, i) => ( <div key={i} className="gk-statgrid__cell gk-surface"> <span className="gk-statgrid__label t-caption">{it.label}</span> <span className="gk-statgrid__value t-readout"> {it.value} {it.unit != null ? ( <span className="gk-statgrid__unit"> {it.unit}</span> ) : null} </span> </div> ))} </div> );}Usage
<StatGrid items={[ { label: "Pace", value: "8'42", unit: "/mi" }, { label: "Heart", value: 128, unit: "bpm" },]} />Props
Prop
Type
Readout
A single-value complication: label + value + optional unit. The glanceable archetype — one number legible in a 1–2 second glance, with tabular numerals.
Timer
A countdown readout: big tabular m:ss, an optional label, and a bar draining toward zero. Self-ticking (end-time anchored, no drift) with pause/resume via running; pass remaining to control it yourself.