GlassKit UI
Components

WeatherTile

A glanceable weather complication: a condition glyph + big temperature, the condition, and an optional location / hi-lo line. A popping surface.

72°
SunnySan Francisco · H:78° L:61°
600 × 600 · live

Installation

npx @glasskit-ui/cli add weather-tile

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/weather-tile.tsximport type { ReactNode } from "react";import { cn } from "../lib/utils";/** * <WeatherTile> — a glanceable weather complication: a condition glyph + big * temperature, the condition text, and an optional location / hi-lo line. A * popping surface; pure display. */export function WeatherTile({  temp,  condition,  icon,  location,  range,  className,}: {  temp: ReactNode;  condition?: ReactNode;  /** Condition glyph — typically a <GlowIcon>. */  icon?: ReactNode;  location?: ReactNode;  /** Hi / lo, e.g. "H:78° L:61°". */  range?: ReactNode;  className?: string;}) {  return (    <div className={cn("gk-weather gk-surface", className)}>      <div className="gk-weather__top">        {icon != null ? <span className="gk-weather__icon">{icon}</span> : null}        <span className="gk-weather__temp">{temp}</span>      </div>      {condition != null ? (        <span className="gk-weather__cond t-body">{condition}</span>      ) : null}      {location != null || range != null ? (        <span className="gk-weather__meta t-caption">          {location}          {location != null && range != null ? " · " : null}          {range}        </span>      ) : null}    </div>  );}

Usage

<WeatherTile  icon={<GlowIcon size="lg"><SunIcon /></GlowIcon>}  temp="72°" condition="Sunny" location="San Francisco" range="H:78° L:61°"/>

Props

Prop

Type