Primitives
Heading
A screen/section title with an optional accent eyebrow above it. Pure display: one heading per view keeps the glance cheap.
Installation
npx @glasskit-ui/cli add headingInstall the SDK (it provides GlassViewport, useDpad and the stylesheet), then copy these files into your project:
npm install @glasskit-ui/react// components/lib/utils.tsimport { clsx, type ClassValue } from "clsx";import { twMerge } from "tailwind-merge";export type { ClassValue };/** * Merge class names the shadcn way: clsx joins conditionals, tailwind-merge * de-dupes conflicting Tailwind utilities so a consumer's `className` override * wins (e.g. passing `px-2` beats the component's `px-6`). Lens components are * Tailwind utilities + `--gk-*` tokens, so this de-dupe matters. */export function cn(...inputs: ClassValue[]): string { return twMerge(clsx(inputs));}/** * 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/heading.tsximport type { ReactNode } from "react";import { cn } from "../lib/utils";/** * <Heading> — a screen/section title with an optional eyebrow label above it. * Pure display. Use sparingly — one heading per view keeps the glance cheap. */export function Heading({ children, eyebrow, className,}: { children: ReactNode; /** Small tracked label above the title. */ eyebrow?: ReactNode; className?: string;}) { return ( <div className={cn("flex flex-col items-center gap-1 text-center", className)}> {eyebrow != null ? ( <span className="t-caption uppercase tracking-[0.16em] text-primary"> {eyebrow} </span> ) : null} <h2 className="t-title">{children}</h2> </div> );}Usage
<Heading eyebrow="Workout">Morning Run</Heading>Props
| Prop | Type | Default | Description |
|---|---|---|---|
children | ReactNode | — | The title. |
eyebrow | ReactNode | — | Small tracked label above. |
className | string | — | Extra classes. |
Masonry
A staggered, vertically-scrolling multi-column layout (the Pinterest / Photos look, where columns do not line up). Drop any children in; Masonry measures each and fills the shortest column, then keeps a D-pad-focused child in view.
Readout
A single-value complication: label, value, and optional unit. The glanceable archetype: one number legible in a 1 to 2 second glance, with tabular numerals.