Skip to main content

Hijri Date

A beautiful component to display both Gregorian and Hijri (Islamic calendar) dates together. Perfect for GCC applications with full bilingual support and multiple layout variants.

Preview

GregorianNovember 6, 2025
Hijri5 Jumada al-Awwal 1447

Installation

Copy and paste the component code into your project:

Dependencies: This component uses Lucide icons which should already be installed in your project.

Usage

Examples

Default

Card-style layout with labels, perfect for prominent date displays.

GregorianNovember 6, 2025
Hijri5 Jumada al-Awwal 1447

Badge

Compact inline badge, great for headers or metadata sections.

Nov 6, 2025
5 Jumada I, 1447

Compact

Minimal inline text, perfect for content flows and timestamps.

Published on
Nov 6, 2025
5 Jumada I, 1447

Detailed

Large, spacious layout with enhanced typography for feature sections.

GregorianNovember 6, 2025
Hijri5 Jumada al-Awwal 1447

In Content

Multiple variants used together in a card layout.

Event Details

Nov 6
5 Jumada I
Join us for a special gathering on
November 6, 2025
5 Jumada al-Awwal 1447
. We look forward to seeing you there!

Integration with Date Conversion Libraries

This component is UI-only and accepts pre-formatted date strings. You can integrate it with Hijri calendar conversion libraries. Here's an example using @formkit/hijri:

Install the library: npm install @formkit/hijri

Props

NameTypeDefaultDescription
gregorianDate
Required
stringGregorian date in English (e.g., "November 6, 2025").
gregorianDateAr
stringundefinedGregorian date in Arabic (optional, displayed in RTL mode if provided).
hijriDate
Required
stringHijri date in English (e.g., "5 Jumada al-Awwal 1447").
hijriDateAr
Required
stringHijri date in Arabic (e.g., "٥ جمادى الأولى ١٤٤٧").
showIcon
booleanfalseDisplay a calendar icon with the dates.
variant
"default" | "badge" | "compact" | "detailed""default"Visual variant controlling layout and styling.
className
stringundefinedAdditional CSS classes for the wrapper element.

Accessibility

The Hijri Date component follows accessibility best practices:

  • Semantic HTML: Uses proper semantic elements for date display.
  • Clear Labels: Date type labels ("Gregorian", "Hijri") provide context.
  • Visual Hierarchy: Consistent styling helps distinguish between date types.
  • Separator: Visual bullet separator in inline variants is marked with aria-hidden.
  • Readable Typography: Font sizes and weights optimized for readability.

RTL Considerations

This component is built with RTL-first principles and automatically adapts to text direction:

  • Automatic Language Detection: Displays Arabic dates (gregorianDateAr, hijriDateAr) in RTL mode.
  • Logical Properties: Uses margin-inline-start (ms-*) and gap for proper spacing.
  • Flexible Layout: All variants adapt seamlessly to both LTR and RTL directions.
  • Icon Positioning: Calendar icon positions correctly in both directions.
  • Text Alignment: Date labels and values align naturally based on direction.

Related Components