Skip to main content

A beautiful component to display both Gregorian and Hijri (Islamic calendar) dates together. Designed for Islamic and Arabic-speaking contexts 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 Phosphor 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
gregorianDateRequired
stringGregorian date in English (e.g., "November 6, 2025").
gregorianDateAr
stringundefinedGregorian date in Arabic (optional, displayed in RTL mode if provided).
hijriDateRequired
stringHijri date in English (e.g., "5 Jumada al-Awwal 1447").
hijriDateArRequired
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.

Use Cases

Islamic calendar date displays

Dual calendar date pickers

Religious event date references

Government document date headers

Best Practices

Do

  • Show both Hijri and Gregorian dates when relevant
  • Use the correct month names in Arabic
  • Support Umm al-Qura calendar for Saudi contexts

Don't

  • Don't assume one-to-one month mapping between calendars
  • Don't use Western numerals for Hijri dates in Arabic context
  • Don't omit the calendar system indicator

Related Components