glasscn
ShowcaseDocsComponentsStudioThemingNative
5Get started
Guides
IntroductionInstallationThemingFonts & typeStudioReact Native
Surfaces
AuroraBackdropGlassLiquid glassCardTheme scopeBackground extensionScroll areaAccordionCollapsibleAlertItemEmpty
Typography
TypographyProse
Controls
ButtonBadgeInputTextareaLabelSwitchCheckboxSegmented controlTabsGlass groupGlass clusterGlass morphSliderProgressKbdSeparatorAvatarGlass preferencesComboboxCalendarDate pickerSpinnerSkeletonSelectRadio groupFieldInput groupButton groupToggleToggle groupStepper
Overlays
DialogAlert dialogSheetAction sheetPopoverTooltipDropdown menuToasterCommandDrawerContext menuConfirmation popover
Navigation
DockToolbarScroll edgeNavigation barSidebarSearch fieldGrouped list
Data
Activity ringsProgress ringSparklineStatKPIWidgetRange chartBar listGaugeTrackerCategory barHeatmapChartArea chartBar chartLine chartDonut chartTableData table
Chat
ChatChat markdownChat parts
Blocks
More Apple glass examplesLiquid Glass examplesDashboardAnalyticsSettingsSign inChat
glasscn — a shadcn registry. Copy it, own it, change it.DocsThemingregistry.json
Data

Tracker

A row of status blocks — uptime, or a habit's last 30 days.

Installation

pnpm dlx shadcn@latest add https://glasscn.app/r/tracker.json

React Native (iOS, Android and web through react-native-web) — same parts and props:

pnpm dlx shadcn@latest add https://glasscn.app/r/native-tracker.json

Or with the namespace set up: shadcn add @glasscn-app/tracker

Props

PropTypeDefault
data{ title, status?, key? }[]

One block each; title is the tooltip and accessible label.

—
colorsRecord<string, string>

Status → colour class, e.g. { up: "bg-primary", down: "bg-destructive" }.

done · partial · missed · rest

Source

components/glass/tracker.tsx
import * as React from "react"
import { cn } from "@/lib/glass-cn"

export interface TrackerBlock {
  /** Shown on hover and read by screen readers. */
  title: string
  /** A status from `colors`; unknown statuses render as empty. */
  status?: string
  key?: string
}

const DEFAULT_COLORS: Record<string, string> = {
  done: "bg-primary",
  partial: "bg-primary/45",
  missed: "bg-foreground/25",
  rest: "bg-fill",
}

/**
 * A row of status blocks — uptime, a habit's last 30 days. Blocks stretch to
 * fill the width. Map your statuses to colour classes with `colors`.
 */
function Tracker({
  data,
  colors = DEFAULT_COLORS,
  className,
  ...props
}: React.ComponentProps<"div"> & {
  data: TrackerBlock[]
  /** Status → colour class (`bg-chart-2`, `bg-primary/40`). */
  colors?: Record<string, string>
}) {
  return (
    <div data-slot="tracker" role="list" className={cn("flex h-control-sm w-full gap-[calc(0.125rem*var(--glass-density))]", className)} {...props}>
      {data.map((b, i) => (
        <div
          key={b.key ?? i}
          role="listitem"
          data-slot="tracker-block"
          data-status={b.status}
          title={b.title}
          aria-label={b.title}
          className={cn(
            "min-w-0 flex-1 transition-transform duration-(--glass-duration) ease-glass first:rounded-s-control-sm last:rounded-e-control-sm hover:scale-y-110 motion-reduce:hover:scale-y-100",
            (b.status && colors[b.status]) || "bg-fill"
          )}
        />
      ))}
    </div>
  )
}

export { Tracker }
GaugeCategory bar
Morning run22 of 30 days
Sep 1Sep 30