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

DateRangePicker

منتقي نطاق تاريخ متاح الوصول في React لتاريخي البداية والنهاية على تقويم واحد. يدعم الإعدادات الجاهزة، العرضين الهجري والميلادي، والحدود، ويشارك DatePicker نواته.

يحدد DateRangePicker نطاقاً { start, end } ويظلل الأيام بينهما. يتشارك مع DatePicker زر التبديل بين الميلادي والهجري ونواة التقويم.

متى تستخدمه

استخدم DateRangePicker لفترات التقارير، طلبات الإجازة، نوافذ الحجز، أو أي عامل تصفية ببداية ونهاية. وفر إعدادات جاهزة مثل "آخر 30 يوماً" للنطاقات الشائعة. إذا كفى تاريخ واحد، استخدم DatePicker.

يتشارك المنتقيان زر التبديل الهجري، مما يتيح استخدام النطاق نفسه مع تقويم أم القرى.

أمثلة

أساسي

إعدادات جاهزة (وصفة تركيب)

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

الخصائص

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

الخاصيةالنوعالافتراضيالوصف
size"md" | "lg"
variant"default" | "filled-lighter" | "filled-darker"
valueDateRangeCurrently selected range (controlled). null clears it.
defaultValueDateRangeInitial range when uncontrolled.
onChange(value: DateRange | null) => voidFires when a complete range is picked, or 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 and aria-required, and blocks native form submission while either end is empty.
startNamestringSubmits the start date under this name in native forms (FormData), as a Gregorian YYYY-MM-DD string even while the calendar displays Hijri. Empty submits "".
endNamestringSubmits the end date under this name. Same format as startName.
formstringAssociates both hidden inputs with a <form> by id, like the native form attribute.
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.
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.
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. Helps cross-reference Hijri↔Gregorian. Default false.

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

يستخدم تقويم النطاق نموذج لوحة المفاتيح نفسه في DatePicker. تتنقل مفاتيح الأسهم بين الأيام، ويغير Page Up وPage Down الشهر. ويختار Enter البداية ثم النهاية. يعلن قارئ الشاشة النطاق المحدد.

ترتبط تسمية الحقل، النص المساعد، ورسالة الخطأ بالحقل كما في TextInput. تعمل الإعدادات الجاهزة كأزرار عادية، لذا يصل إليها مستخدم لوحة المفاتيح.