Stablev0.1.0date

TaiwanHolidayBadge

台灣國定假日標籤

依行政院人事行政總處公告日曆,標示國定/農曆/彈性假日,並以不同色調區分。非假日不顯示。資料涵蓋 2025–2026。

Renders a coloured badge if a given date is a Taiwan public holiday per 行政院人事行政總處 (DGPA) calendar. National / lunar / adjusted holidays each get a distinct tone. Quietly renders nothing for non-holiday dates.

Installation

CLI

npx taiwan-ui add taiwan-holiday-badge

npm package

npm install @taiwan-ui/react

Requires: data/taiwan-holidays.json

Live Demo

Showing 2026 holidays + one regular workday for contrast:

2026-02-17春節
2026-02-28和平紀念日
2026-04-03兒童節 / 民族掃墓節
2026-05-01勞動節
2026-09-25中秋節
2026-10-10國慶日
2026-04-15— 一般日 —

Props API

PropTypeDefault
date*Date | string
englishbooleanfalse
size"sm" | "md""md"
fallbackReact.ReactNode

Playground

Props

要檢查的日期

使用英文假日名

標籤尺寸

Non-editable type — edit in code.

非假日時的替代內容

Generated code
import TaiwanHolidayBadge from "@/components/taiwan/TaiwanHolidayBadge";

export default function Example() {
  return (
    <TaiwanHolidayBadge
  size="md"
/>
  );
}

Code Examples

import TaiwanHolidayBadge from "@/components/taiwan/TaiwanHolidayBadge";

export default function HolidayCheck() {
  return (
    <div>
      <TaiwanHolidayBadge date="2026-02-17" />
      <TaiwanHolidayBadge date="2026-10-10" />
    </div>
  );
}
國定假日農曆假日DGPA行政院

Related Components