GlassKit UI
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.

Pace8'42 /mi
Heart128 bpm
Dist3.2 km
Time18:40
600 × 600 · live

Installation

npx @glasskit-ui/cli add stat-grid

Install 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