graphs

Activity

A GitHub-style contribution grid: one cell per day, weeks across the frame, on a shared intensity scale.

Install

pnpm add @fractaldesign/machines-ui
import '@fractaldesign/machines-ui/style.css';
import { GraphActivity } from '@fractaldesign/machines-ui';

Preview

[ COMMITS ]
SepOctNovDecJanFebMarAprMayJunJulAugSep
MWF
·░·░▒··
··░▒░░·
░░▒·░··
·▒·░·░░
··░░·█·
·░··█··
···█░··
··█··░·
·█··░▒·
···░▒··
·░░▒·░·
·░▒·░··
·▒░░···
··░··█·
·░·░█··
░░·█···
··█·░░░
·█░·░▒·
···░▒░·
··░▒·░·
·░▒·░··
·▒·░░··
··░··█·
·░··█░·
···█···
·░█··░·
·█··░▒·
··░░▒··
░·░▒·░·
·░▒░░·░
·▒·░···
··░·░█·
·░░·█··
···█·░·
··█░·░·
·█··░▒·
···░▒··
··░▒·░·
·░▒·░░·
·▒·░···
·░░··█·
░░··█··
··░█··░
··█··░·
·█·░░▒·
·░·░▒··
··░▒░░·
·░▒·░··
·▒·░·░·
··░░·█·
·░··█··
···█░··
··█··░·
·······
774 contributions across 371 days
<script lang="ts">
	import { GraphActivity } from '@fractaldesign/machines-ui';

	// Pass dated counts; weeks, months, and intensity are derived.
</script>

<GraphActivity
  title="COMMITS"
  palette="multi"
  days={[
    { date: '2025-09-01', count: 3 },
    { date: '2025-09-02', count: 12 }
    // ...one per day, gaps fill as empty
  ]}
/>
[ SHIPPED ]
JunJulAug
MWF
-.-=...
.-=--.-
-=.-...
=.-.--.
.--.@..
-..@...
..@-...
.@..-..
@..-=..
..-=...
--=.-..
-=.-...
=--....
182 contributions across 91 days. Jun – Aug
import { GraphActivity } from '@fractaldesign/machines-ui';

<GraphActivity
  title="SHIPPED"
  weekStartsOn={1}
  glyphs="ascii"
  days={activityDays('2026-06-01', 91)}
  caption="Jun – Aug"
/>

Props

PropTypeDefaultDescription
title* string —Caption drawn on the top edge as `[ TITLE ]`. Uppercase, 1–2 words.
days* ActivityDay[] —Dated counts, one per day; gaps between dates fill in as empty.
weekStartsOn 0 | 1 0First day of the week, 0 for Sunday and 1 for Monday.
max number —Ceiling of the intensity scale; defaults to the highest count.
legend boolean trueShow the intensity legend below the grid.
caption string | false —Extra sentence appended to the contribution summary.
glyphs Glyphs —Characters that draw the graph: a preset name (`shade`, `ascii`, `hash`, `bar`) or your own array, lightest to heaviest.
palette GraphPalette
'mono''duo''multi'
—How many accent colours the graph uses: `mono` one, `duo` two, `multi` three.
corner string —Character drawn at each corner of the frame.
class string ''

API

  • class forwarded to the outer element
  • motion reveals on scroll into view

Types

NameKindDescription
ActivityDayinterfaceGitHub-style contribution grid: weeks across the frame, days down.
Celltype
{ date: string; count: number; inRange: boolean }

Theming

CSS custom properties this component reads.

  • --border
  • --graph-accent
  • --graph-accent-2
  • --graph-accent-3
  • --text-primary
  • --text-secondary

Related

Built from

src/lib/components/graphs/GraphActivity.svelte

machines-ui