SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

ContributionGraph

A year of per-day counts at a glance, as a real <table role="grid">.

Open in a new tab
View code
tsx
<ContributionGraph
	days={days}
	start="2025-11-14"
	end="2026-11-13"
	locale="en-US"
	href={(date) => `/sergiodxa?tab=overview&from=${date}&to=${date}`}
	labels={{
		caption: `${total.toLocaleString("en-US")} contributions in the last year`,
		day: (count, date) => `${count === 0 ? "No" : count} contribution${count === 1 ? "" : "s"} on ${date}`,
		less: "Less",
		more: "More",
	}}
/>

Demo apps

Whole pages built only from @sdxc/ui, each for an invented product with its own palette and type. They open in a new tab.

Every demo, landings and docs sites alike, is listed in the demo gallery.

Installation

An ordinary dependency: install it, import the theme once, and import the component where it is used.

Terminal
npm add @sdxc/ui remix
typescript
import "@sdxc/ui/theme.css";

Usage

typescript
import { ContributionGraph } from "@sdxc/ui/app";

Without script each day's title names its count; mapping @sdxc/ui/app/contribution-graph in the browser entry runs ContributionGraphTooltip, for a shared tooltip and arrow keys. Size it with --ui-contribution-graph-cell and -gap, match -bg to the surface, tint --graph-level-0–4.

Props

Read from the component's own types, so every prop, every default and every allowed value is listed.

PropTypeRequiredDescription
daysreadonly Day[]YesThe counts to plot, in any order; only days between start and end are drawn.
startstringYesThe first day drawn, as YYYY-MM-DD.
endstringYesThe last day drawn, as YYYY-MM-DD; its week is kept in view on a phone.
levelsreadonly number[]NoLower bound of levels 0 to 4: a day takes the highest level its count reaches. @default [0, 1, 4, 8, 12]
href(date: string) => stringNoWhere a day leads, such as that day's activity; days are links when set.
localestringNoLocale for month and weekday names, and for the first day of the week.
weekStartnumberNoFirst day of the week, 0 = Sunday; defaults to the locale's.
labelsLabelsYesEvery string the graph shows, so it reads in any language.

Also accepts everything in Omit<TagProps<"div">, "children">.

Other components this module publishes.

  • weekStartFor
  • contributionLevel
@sdxc/ui

Can’t find it? Contact us