DatePicker
달력 내비게이션, 뷰 전환, 시간 선택을 지원하는 스타일 없는 날짜 선택 컴포넌트예요.
출처: 문서
본문
기능 (Features)
- 하위 컴포넌트 구성 API:
Root,Input,Trigger,Value,Clear,ClearTrigger,Portal,Positioner,Arrow,Popup,Body,Panel,Calendar,Header,Prev,Next,Title,SelectMonth,SelectYear,Decade,Table,TableHead,TableHeadRow,TableHeadCell,TableHeadWeekCell,TableHeadWeekLabel,TableHeadWeekHeaderLabel,TableBody,TableBodyRow,TableBodyCell,TableBodyWeekCell,TableBodyWeekLabel,Day,Month,Year,Time,Picker,Hour,Minute,Second,AmPm,Increment,Decrement,Separator,Buttonbar,Footer,Today - 월, 연, 십 년 단위 사이를 애니메이션으로 이동하는 세 가지 달력 뷰
- 키보드 포커스 순환을 갖춘 단일, 다중, 범위 날짜 선택
- 12/24시간 형식, 분, 초 컨트롤이 통합된 시간 선택기
사용법 (Usage)
import { DatePicker } from 'primereact/datepicker';
<DatePicker.Root>
<DatePicker.Input />
<DatePicker.Portal>
<DatePicker.Positioner>
<DatePicker.Popup>
<DatePicker.Arrow />
<DatePicker.Calendar>
<DatePicker.Header>
<DatePicker.Prev></DatePicker.Prev>
<DatePicker.Title>
<DatePicker.SelectMonth />
<DatePicker.SelectYear />
<DatePicker.Decade />
</DatePicker.Title>
<DatePicker.Next></DatePicker.Next>
</DatePicker.Header>
<DatePicker.Table>
<DatePicker.TableHead />
<DatePicker.TableBody />
<DatePicker.TableBody view="month" />
<DatePicker.TableBody view="year" />
</DatePicker.Table>
<DatePicker.Buttonbar>
<DatePicker.Today></DatePicker.Today>
<DatePicker.ClearTrigger></DatePicker.ClearTrigger>
</DatePicker.Buttonbar>
</DatePicker.Calendar>
<DatePicker.Time>
<DatePicker.Picker type="hour">
<DatePicker.Increment></DatePicker.Increment>
<DatePicker.Hour />
<DatePicker.Decrement></DatePicker.Decrement>
</DatePicker.Picker>
<DatePicker.Separator />
<DatePicker.Picker type="minute">
<DatePicker.Increment></DatePicker.Increment>
<DatePicker.Minute />
<DatePicker.Decrement></DatePicker.Decrement>
</DatePicker.Picker>
</DatePicker.Time>
</DatePicker.Popup>
</DatePicker.Positioner>
</DatePicker.Portal>
</DatePicker.Root>
동작 (Behavior)
동작 애니메이션 (Motion Animation)
<DatePicker.Popup motionProps={{ name: 'p-datepicker' }}>...</DatePicker.Popup>
애니메이션 단계, CSS 변수, 숨김 전략은 Motion 문서를 참고하세요.
다형적 렌더링 (Polymorphic Rendering)
as를 사용해 하위 컴포넌트가 렌더링할 HTML 요소를 바꿀 수 있어요.
<DatePicker.Root as="section">
<DatePicker.Input as="div" />
<DatePicker.Prev as="a">...</DatePicker.Prev>
</DatePicker.Root>
렌더 함수 자식 (Render Function Children)
DatePicker.TableBody, DatePicker.TableHead, 그리고 다른 컨테이너 컴포넌트들은 커스텀 셀 렌더링을 위해 컴포넌트 인스턴스에 접근할 수 있는 렌더 함수를 children으로 받아요.
<DatePicker.TableBody>
{(instance) =>
instance.datepicker?.months[0]?.dates.map((week, weekIndex) => (
<DatePicker.TableBodyRow key={weekIndex}>
{week.map((date, dateIndex) => (
<DatePicker.TableBodyCell key={dateIndex} date={date}>
<DatePicker.Day>{date.day}</DatePicker.Day>
</DatePicker.TableBodyCell>
))}
</DatePicker.TableBodyRow>
))
}
</DatePicker.TableBody>
Pass Through
<DocPTViewer name="datepicker-pt" components={['DatePickerRoot']} />
API
DatePickerRoot
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"root" |
data-disabled |
Present when disabled |
data-invalid |
Present when invalid |
data-readonly |
Present when read-only |
| Label | Type | Description |
|---|---|---|
| root | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
| pcInputText | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the input's DOM element. |
| panel | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the panel's DOM element. |
| calendarContainer | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the calendarContainer's DOM element. |
| calendar | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the calendar's DOM element. |
| header | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the header's DOM element. |
| prev | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the prev's DOM element. |
| title | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the title's DOM element. |
| selectMonth | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the selectMonth's DOM element. |
| selectYear | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the selectYear's DOM element. |
| decade | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the decade's DOM element. |
| next | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the next's DOM element. |
| dayView | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the dayView's DOM element. |
| monthView | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the monthView's DOM element. |
| yearView | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the yearView's DOM element. |
| tableHeader | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the tableHeader's DOM element. |
| tableHeaderRow | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the tableHeaderRow's DOM element. |
| weekDayCell | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the weekDayCell's DOM element. |
| weekDay | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the weekDay's DOM element. |
| weekHeader | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the weekHeader's DOM element. |
| weekHeaderLabel | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the weekHeaderLabel's DOM element. |
| tableBody | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the tableBody's DOM element. |
| tableBodyRow | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the tableBodyRow's DOM element. |
| dayCell | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the dayCell's DOM element. |
| monthCell | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the monthCell's DOM element. |
| yearCell | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the yearCell's DOM element. |
| weekNumber | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the weekNumber's DOM element. |
| weekLabel | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the weekLabel's DOM element. |
| buttonbar | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the buttonbar's DOM element. |
| today | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the today's DOM element. |
| clear | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the clear's DOM element. |
| timePicker | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the timePicker's DOM element. |
| hourPicker | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the hourPicker's DOM element. |
| minutePicker | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the minutePicker's DOM element. |
| secondPicker | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the secondPicker's DOM element. |
| ampmPicker | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the ampmPicker's DOM element. |
| increment | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the increment's DOM element. |
| decrement | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the decrement's DOM element. |
| hour | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the hour's DOM element. |
| minute | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the minute's DOM element. |
| second | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the second's DOM element. |
| ampm | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the ampm's DOM element. |
| separator | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the separator's DOM element. |
| clearTrigger | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the clearTrigger's DOM element. |
| trigger | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the trigger's DOM element. |
| positioner | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the positioner's DOM element. |
| popup | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the popup's DOM element. |
| arrow | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the arrow's DOM element. |
| day | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the day's DOM element. |
| month | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the month's DOM element. |
| year | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the year's DOM element. |
| value | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the value's DOM element. |
| footer | DatePickerRootPassThroughType<HTMLAttributes> | Used to pass attributes to the footer's DOM element. |
DatePickerInput
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"input" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerInputPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTrigger
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"trigger" |
DatePickerValue
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"value" |
DatePickerClear
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"clear" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerClearPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerClearTrigger
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"clear-trigger" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerClearTriggerPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerPortal
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"portal" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerPortalPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerPositioner
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"positioner" |
data-side |
"top" | "bottom" | "left" | "right", placement |
data-align |
"start" | "center" | "end", alignment |
CSS 커스텀 프로퍼티 (CSS Custom Properties)
positioner 요소는 레이아웃과 transform 제어를 위한 CSS 커스텀 프로퍼티를 노출해요.
| CSS Variable | Description |
|---|---|
--available-height |
Available vertical space in pixels |
--available-width |
Available horizontal space in pixels |
--transform-origin |
Computed transform origin for animations |
--positioner-anchor-width |
Width of the anchor/trigger element |
DatePickerPopup
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"popup" |
data-open |
Present when popup is open |
DatePickerArrow
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"arrow" |
data-side |
"top" | "bottom" | "left" | "right", placement |
data-align |
"start" | "center" | "end", alignment |
CSS 커스텀 프로퍼티 (CSS Custom Properties)
arrow 요소는 동적 위치 지정을 위한 CSS 커스텀 프로퍼티를 노출해요:
| CSS Variable | Description |
|---|---|
--placer-arrow-x |
Horizontal offset of arrow |
--placer-arrow-y |
Vertical offset of arrow |
--placer-arrow-left |
Left position of arrow element |
--placer-arrow-top |
Top position of arrow element |
DatePickerBody
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"body" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerBodyPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerPanel
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"panel" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerPanelPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerCalendar
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"calendar" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerCalendarPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerHeader
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"header" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerHeaderPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerPrev
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"prev" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerPrevPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerNext
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"next" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerNextPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTitle
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"title" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTitlePassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerSelectMonth
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"select-month" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerSelectMonthPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerSelectYear
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"select-year" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerSelectYearPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerDecade
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"decade" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerDecadePassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTable
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"table" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTablePassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTableHead
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"tableHeader" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTableHeadPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTableHeadRow
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"tableHeaderRow" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTableHeadRowPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTableHeadCell
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"weekDayCell" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTableHeadCellPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTableHeadWeekCell
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"weekHeader" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTableHeadWeekCellPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTableHeadWeekLabel
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"weekDay" |
DatePickerTableHeadWeekHeaderLabel
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"weekHeaderLabel" |
DatePickerTableBody
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"tableBody" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTableBodyPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTableBodyRow
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"tableBodyRow" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTableBodyRowPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTableBodyCell
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"cell" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTableBodyCellPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTableBodyWeekCell
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"weekNumber" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTableBodyWeekCellPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerTableBodyWeekLabel
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"weekLabel" |
DatePickerDay
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"day" |
data-selected |
"true" when selected |
data-disabled |
"true" when disabled |
data-today |
"true" on today's date |
data-other-month |
"true" for adjacent months |
DatePickerMonth
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"month" |
data-selected |
"true" when selected |
data-disabled |
"true" when disabled |
DatePickerYear
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"year" |
data-selected |
"true" when selected |
data-disabled |
"true" when disabled |
DatePickerTime
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"timePicker" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTimePassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerPicker
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"hourPicker" | "minutePicker" | "secondPicker" | "ampmPicker" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerPickerPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerHour
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"hour" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerHourPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerMinute
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"minute" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerMinutePassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerSecond
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"second" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerSecondPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerAmPm
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"ampm" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerAmPmPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerIncrement
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"increment" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerIncrementPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerDecrement
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"decrement" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerDecrementPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerSeparator
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"separator" |
DatePickerButtonbar
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"buttonbar" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerButtonbarPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerFooter
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"footer" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerFooterPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerToday
| Attribute | Value |
|---|---|
data-scope |
"datepicker" |
data-part |
"today" |
| Label | Type | Description |
|---|---|---|
| root | DatePickerTodayPassThroughType<HTMLAttributes> | Used to pass attributes to the root's DOM element. |
DatePickerDropdown
접근성 (Accessibility)
스크린 리더 (Screen Reader)
컴포넌트를 설명할 값은 inputId prop과 결합된 label 태그, 또는 aria-labelledby, aria-label prop으로 제공할 수 있어요. 입력 요소는 combobox 역할과 함께 aria-autocomplete(값 "none"), aria-haspopup(값 "dialog"), aria-expanded 속성을 가져요. 입력과 팝업 사이의 관계는 팝업의 id를 참조하는 aria-controls 속성으로 만들어져요.
선택적인 datepicker 버튼은 상태용 aria-haspopup, aria-expanded와 함께, 팝업과 버튼 사이의 관계를 정의하는 aria-controls를 포함해야 해요.
팝업은 aria-modal과 aria-label과 함께 dialog 역할을 가져요. 헤더의 내비게이션 버튼에는 locale aria API에서 가져온 aria-label이 있어요. 마찬가지로 월 선택 버튼은 chooseMonth, 연도 선택 버튼은 chooseYear 키를 사용해요.
기본 날짜 테이블은 col을 scope로 하는 th 요소와 월 전체 이름으로 해석되는 abbr 태그를 포함한 grid 역할을 사용해요. 각 날짜 셀에는 전체 날짜 값을 참조하는 aria-label이 있어요. 푸터의 버튼들도 읽을 수 있는 라벨을 aria-label로 사용해요. 선택된 날짜에는 aria-selected 속성도 전달돼요.
시간 선택기 스피너 버튼은 prevHour, nextHour, prevMinute, nextMinute, prevSecond, nextSecond, am, pm 키를 사용해 aria locale API에서 aria-label 라벨을 가져와요.
DatePicker는 스크린 리더에서만 볼 수 있는 숨겨진 섹션도 포함하는데, aria-live가 "polite"예요. 이 요소는 선택된 날짜가 바뀔 때 갱신되어 사용자에게 현재 선택된 날짜를 안내해요.
날짜 선택 버튼 키보드 지원 (Choose Date Button Keyboard Support)
| Key | Function |
|---|---|
space |
Opens popup and moves focus to the selected date, if there is none focuses on today. |
enter |
Opens popup and moves focus to the selected date, if there is none focuses on today. |
팝업 키보드 지원 (Popup Keyboard Support)
| Key | Function |
|---|---|
escape |
Closes the popup and moves focus to the input element. |
tab |
Moves focus to the next focusable element within the popup. |
shift + tab |
Moves focus to the next focusable element within the popup. |
헤더 버튼 키보드 지원 (Header Buttons Keyboard Support)
| Key | Function |
|---|---|
enter |
Triggers the button action. |
space |
Triggers the button action. |
날짜 그리드 키보드 지원 (Date Grid Keyboard Support)
| Key | Function |
|---|---|
enter |
Selects the date, closes the popup and moves focus to the input element. |
space |
Closes the popup and moves focus to the input element. |
up arrow |
Moves focus to the same day of the previous week. |
alt + up arrow |
Closes the popup and moves focus to the input element. |
down arrow |
Moves focus to the same day of the next week. |
right arrow |
Moves focus to the next day. |
left arrow |
Moves focus to the previous day. |
home |
Moves focus to the first day of the current week. |
end |
Moves focus to the last day of the current week. |
page up |
Changes the date to previous month in date picker mode. Moves to previous year in month picker mode and previous decade in year picker. |
shift + page up |
Changes the date to previous year in date picker mode. Has no effect in month or year picker. |
page down |
Changes the date to next month in date picker mode. Moves to next year in month picker mode and next decade in year picker. |
shift + page down |
Changes the date to next year in date picker mode. Has no effect in month or year picker. |
푸터 버튼 키보드 지원 (Footer Buttons Keyboard Support)
| Key | Function |
|---|---|
enter |
Triggers the button action. |
space |
Triggers the button action. |