Introducing shieldcn — README badges, shadcn style.

Check it out

License Badge

Software license badge with SPDX identifier, category color-coding, and OSI-approved indicator.

class-variance-authority
Loading...

Installation

$ shadcn add @jalco/license-badge

Usage

import { LicenseBadge } from "@/components/license-badge"
<LicenseBadge license="MIT" />

Pass a license SPDX identifier directly, or use owner/repo to fetch the license from the GitHub API. When using the API, this is an async server component with 1-hour ISR caching.

Examples

Layouts

Three layouts: inline pill (default), segmented row, and expanded card.

Loading...

License categories

Licenses are automatically categorized and color-coded by type.

Loading...

API Reference

LicenseBadge

PropType

Notes

  • Dual input. Pass a license string for static rendering, or owner/repo to fetch from GitHub.
  • ISR caching. GitHub API data cached for 1 hour. Optional GITHUB_TOKEN raises the rate limit.
  • SPDX resolution. Handles case-insensitive matching, -only and -or-later suffixes.
  • Category colors. Green for permissive, amber for copyleft, sky for weak copyleft, violet for public domain, rose for proprietary.