# preact-github-calendar

> Preact Component that Displays a User's GitHub Contribution Calendar

Latest version **0.5.10** (published 2022-04-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install preact-github-calendar
pnpm add preact-github-calendar
yarn add preact-github-calendar
bun add preact-github-calendar
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.10 |
| Published | 2022-04-06 |
| First published | 2020-05-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 9.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Maintainers | rschristian |
| Keywords | preact, github, contribution, calendar, component |

## Links

- npm: https://www.npmjs.com/package/preact-github-calendar
- Repository: https://github.com/rschristian/preact-github-calendar
- Homepage: https://rschristian.github.io/preact-github-calendar
- Issues: https://github.com/rschristian/preact-github-calendar/issues
- npm.io page: https://npm.io/package/preact-github-calendar

## Dependencies (1)

- [preact-hint](https://npm.io/package/preact-hint.md) ^0.2.0

## Recent versions

- 0.5.10 (latest) — 2022-04-06
- 0.5.9 — 2022-04-06
- 0.5.8 — 2021-05-12
- 0.5.7 — 2021-05-12
- 0.5.6 — 2021-05-09
- 0.5.5 — 2020-11-01
- 0.5.4 — 2020-10-29
- 0.5.3 — 2020-10-26
- 0.5.2 — 2020-09-28
- 0.5.1 — 2020-09-28
- 0.5.0 — 2020-09-21
- 0.4.2 — 2020-09-09
- 0.4.1 — 2020-08-18
- 0.4.0 — 2020-08-16
- 0.3.0 — 2020-08-07
- … 25 more at https://npm.io/package/preact-github-calendar/versions

## README

<h1 align="center">Preact GitHub Calendar</h1>

<div align="center">
    <a href="https://github.com/rschristian/preact-github-calendar/blob/master/LICENSE">
        <img
            alt="NPM"
            src="https://img.shields.io/npm/l/preact-github-calendar?color=brightgreen"
        />
    </a>
</div>

<br />

`preact-github-calendar` is a small (1.3kb brotli) component library used for displaying [a user's contribution calendar from GitHub](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/managing-contribution-graphs-on-your-profile/viewing-contributions-on-your-profile#contributions-calendar). This component comes with customization options that you can use for making the component better adhere to the style of your application. Requests for additional customization options are always welcome.

Try out [the demo](https://preact-hint.rschristian.dev/)!

## Install

```
$ yarn add preact-github-calendar
```

## Usage

```jsx
import GitHubCalendar from 'preact-github-calendar';
import 'preact-github-calendar/style.css';

export default function App() {
    return <GitHubCalendar username="rschristian" />;
}
```

## API

All options are entirely optional, no need to provide the `options` prop if you have no wish to customize anything. These only override the defaults; if you like the display, no need to change anything!

### blockMargin

Type: `number`<br/>
Default: `2`

Sets the margin to be used between the blocks in the component. This affects both the vertical and horizontal margins.

### blockSize

Type: `number`<br/>
Default: `12`

Sets the size of the blocks in the component. This affects both the vertical and horizontal dimensions.

### contributionColorArray

Type: `['<color>', '<color>', '<color>', '<color>', '<color>']`<br/>
Default: `['#ebedf0', '#9be9a8', '#40c463', '#30a14e', '#216e39']`

Changes the color spread in the calendar. The first item in the array replaces the color for least commits, and the last item replaces the color for most commits. Like the `labelColor` option, keywords, RGB(A) and HSL(A) values are all supported as valid colors. Default is GitHub's color scheme.

### labelFontSize

Type: `number`<br/>
Default: `14`

Changes the font size of the month and days of the week labels.

### showTooltip

Type: `boolean`<br/>
Default: `true`

Show a tooltip when hovering over calendar elements. Shows the number of contributions and the date for the element.

### showWeekdaysLabels

Type: `boolean`<br/>
Default: `false`

Add the week day labels to the left axis of the graph.

## License

MIT © Ryan Christian

---
_Source: https://npm.io/package/preact-github-calendar · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
