npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rsalianto/git-heatmap-vue

v0.1.7

Published

Vue 3 component and composable for GitHub/GitLab contribution heatmaps

Readme

@rsalianto/git-heatmap-vue

Vue 3 component and composable for displaying GitHub/GitLab contribution heatmaps.

git-heatmap preview

Part of the @rsalianto/git-heatmap family — available for React, Vue, Angular, Vanilla JS, and Next.js.

Installation

npm install @rsalianto/git-heatmap-vue

@rsalianto/git-heatmap-core is not required separately — buildHeatmapData, buildHeatmapDataForYear, and normalizeManual are re-exported directly from this package.


Usage

Register globally (plugin)

// main.ts
import { createApp } from "vue";
import { GitHeatmapPlugin } from "@rsalianto/git-heatmap-vue";
import App from "./App.vue";

createApp(App).use(GitHeatmapPlugin).mount("#app");
<template>
  <GitHeatmap api-url="/api/contributions" @day-click="onDayClick" />
</template>

Import locally

<script setup lang="ts">
import { GitHeatmap } from "@rsalianto/git-heatmap-vue";

function onDayClick(day: { date: string; count: number }) {
  console.log(day);
}
</script>

<template>
  <GitHeatmap api-url="/api/contributions" @day-click="onDayClick" />
</template>

Pass data directly

<script setup lang="ts">
import { GitHeatmap, buildHeatmapData } from "@rsalianto/git-heatmap-vue";

const data = buildHeatmapData([
  { date: "2025-06-01", count: 4 },
  { date: "2025-06-15", count: 9 },
]);
</script>

<template>
  <GitHeatmap :data="data" />
</template>

Display a specific year

<script setup lang="ts">
import { GitHeatmap, buildHeatmapDataForYear } from "@rsalianto/git-heatmap-vue";

const data = buildHeatmapDataForYear(allEntries, 2024);
</script>

<template>
  <GitHeatmap :data="data" />
</template>

Server-side data (Nuxt)

// server/api/contributions.get.ts
import { fetchGitHubContributions } from "@rsalianto/git-heatmap-core/fetchers/github";

export default defineEventHandler(async () => {
  return fetchGitHubContributions({
    username: "your-username",
    token: process.env.GITHUB_TOKEN!,
  });
});
<script setup>
const { data } = await useFetch("/api/contributions");
</script>
<template>
  <GitHeatmap :data="data" />
</template>

Props

| Prop | Type | Default | Description | |---|---|---|---| | data | HeatmapData | — | Pre-fetched data — skips internal fetching | | apiUrl | string | — | Endpoint returning HeatmapData JSON | | fetchData | () => Promise<HeatmapData> | — | Custom async data resolver | | levels | LevelConfig[] | DEFAULT_LEVELS | Color thresholds (5 levels) | | cellSize | number | 10 | Cell width/height in px | | cellGap | number | 3 | Gap between cells in px | | cellRadius | number | 2 | Cell border radius in px | | showTotal | boolean | true | Show "N contributions in the last year" | | showLegend | boolean | true | Show Less / More legend | | showMonthLabels | boolean | true | Show month labels above the grid | | showDayLabels | boolean | true | Show Mon / Wed / Fri labels | | theme | Partial<HeatmapTheme> | — | Override CSS variable defaults via props | | label | string | "Contribution heatmap" | aria-label for the grid |

Events

| Event | Payload | Description | |---|---|---| | day-click | HeatmapDay | Emitted when a cell is clicked |


HeatmapData shape

This is the format your apiUrl endpoint must return:

{
  "totalContributions": 312,
  "source": "github",
  "weeks": [
    {
      "days": [
        { "date": "2025-01-05", "count": 0,  "level": 0 },
        { "date": "2025-01-06", "count": 3,  "level": 1 },
        { "date": "2025-01-07", "count": 8,  "level": 2 },
        { "date": "2025-01-08", "count": 14, "level": 3 },
        { "date": "2025-01-09", "count": 22, "level": 4 },
        { "date": "2025-01-10", "count": 1,  "level": 1 },
        { "date": "2025-01-11", "count": 0,  "level": 0 }
      ]
    }
  ]
}

Theming

Via theme prop

<GitHeatmap
  api-url="/api/contributions"
  :theme="{
    colorL0: '#161b22',
    colorL1: '#0e4429',
    colorL2: '#006d32',
    colorL3: '#26a641',
    colorL4: '#39d353',
    textColor: 'rgba(255,255,255,0.5)',
    tooltipBg: '#1c2128',
  }"
/>

Via CSS variables

/* Dark (default) */
.heatmap-wrapper {
  --ghm-color-l0: rgba(255,255,255,0.08);
  --ghm-color-l1: #1c3d06;
  --ghm-color-l2: #3a7510;
  --ghm-color-l3: #6ab81e;
  --ghm-color-l4: #aafd35;
  --ghm-text: rgba(255,255,255,0.5);
  --ghm-tooltip-bg: #1c2128;
  --ghm-tooltip-border: rgba(255,255,255,0.1);
  --ghm-tooltip-text: rgba(255,255,255,0.75);
  --ghm-font: inherit;
  --ghm-fs: 11px;
  --ghm-selected: rgba(255,255,255,0.7);
  --ghm-skeleton-opacity: 0.4;
}

/* Light theme */
.heatmap-wrapper {
  --ghm-color-l0: #ebedf0;
  --ghm-color-l1: #9be9a8;
  --ghm-color-l2: #40c463;
  --ghm-color-l3: #30a14e;
  --ghm-color-l4: #216e39;
  --ghm-text: rgba(0,0,0,0.5);
  --ghm-tooltip-bg: #fff;
  --ghm-tooltip-border: #d0d7de;
  --ghm-tooltip-text: #24292f;
  --ghm-selected: rgba(0,0,0,0.4);
}

useHeatmapData composable

import { useHeatmapData } from "@rsalianto/git-heatmap-vue";

const { data, status, error } = useHeatmapData({ apiUrl: "/api/contributions" });
// status: Ref<"idle" | "loading" | "success" | "error">

Related packages