منتقي التاريخ

DatePicker

منتقي تاريخ متاح الوصول في React بتبديل داخل التقويم بين الهجري (أم القرى) والميلادي، وحدّين أدنى وأقصى، ودعم عربي. القيمة دائمًا Date.

يختار DatePicker تاريخًا واحدًا مع تبديل بين التقويمين الميلادي والهجري داخل التقويم. القيمة دائمًا Date | null، والعرض الهجري للعرض فقط.

متى تستخدمه

استخدم DatePicker لتاريخ واحد مثل تاريخ الميلاد أو الموعد أو إصدار الوثيقة. تحتاج الخدمات السعودية غالبًا إلى التقويمين: فعّل العرض الهجري وshowSecondaryCalendar ليظهر مع كل يوم مقابله.

قيّد النطاق بـ minValue وmaxValue لمنع التواريخ غير الصالحة. لبداية ونهاية استخدم DateRangePicker.

أمثلة

أساسي

التقويم الهجري

نطاق محدود

مُتحكَّم به مع عرض

الخصائص

الخصائص التي يعرّفها DatePicker. سمات العنصر الأصلي تمرّ كما هي.

الخاصيةالنوعالافتراضيالوصف
size"md" | "lg"
variant"default" | "filled-lighter" | "filled-darker"
valueDateCurrently selected date (controlled). Local Y/M/D.
defaultValueDateInitial value when uncontrolled.
onChange(value: Date | null) => voidFires whenever the user picks a day. null when cleared.
minValueDateEarliest pickable date (inclusive).
maxValueDateLatest pickable date (inclusive).
labelreact.ReactNodeVisible label above the trigger.
helperTextreact.ReactNodeHint shown below the trigger. Hidden while an error message is showing.
errorMessagereact.ReactNodeMessage shown below the trigger when error is true.
errorbooleanMarks the field invalid - sets aria-invalid and error styling.
requiredbooleanMarks the field required - adds the asterisk + aria-required.
disabledbooleanDisables the trigger entirely.
readOnlybooleanRead-only: value is shown but not editable (segments + calendar locked).
idstringCaller-supplied id for the field.
classNamestringForwarded to the Group (the trigger row), matching Input/Select.
aria-labelstring
aria-labelledbystring
calendarCalendarSystemCalendar system (controlled). Omit to let the user toggle freely with the in-popover switch.
defaultCalendarCalendarSystemInitial calendar system when uncontrolled. Defaults to 'gregorian'.
onCalendarChange(calendar: CalendarSystem) => voidFires whenever the calendar system toggles.
showCalendarTogglebooleanShow the Gregorian↔Hijri toggle inside the popover. Defaults to true, but is forced off when calendar is controlled - a toggle that ignores its click is a worse footgun than no toggle.
calendarLabelsCalendarLabelsOverride the toggle labels. Defaults are locale-aware (English / Arabic).
showSecondaryCalendarbooleanWhen true, each day cell also shows the other calendar's day number as small secondary text (e.g., Hijri active → Gregorian day shown small underneath). Helps users cross-reference dates between calendar systems without round-tripping the toggle. Defaults to false.

إمكانية الوصول

يتّبع التقويم نمط الشبكة من React Aria: مفاتيح الأسهم تتحرّك بين الأيام، وPage Up وPage Down يغيّران الشهر، وEscape يغلق اللوحة. تُربط تسمية الحقل والنص المساعد والخطأ كما في TextInput، ولزر تبديل التقويم اسم متاح.

تُعلن التواريخ بنظام التقويم النشط، فيسمع مستخدمو الهجري تواريخ هجرية.