@atlaskit/calendar
날짜 선택과 표시를 위한 캘린더 컴포넌트예요.
출처: 문서
본문
Calendar 컴포넌트
날짜 선택과 표시를 위한 캘린더 컴포넌트예요. 이 컴포넌트는 베타(Beta) 단계로, 1.0+ 버전에서 안정적이지만 고객 피드백에 따라 개선될 수 있어요.
- Keywords: calendar, date, picker, selection, month, year, beta
- Categories: form
- Status: general-availability
예시
import Calendar from '@atlaskit/calendar/calendar';
const Examples = (): React.JSX.Element => (
<>
<Calendar
selected={['2024-03-15']}
onChange={(dates) => console.log('Selected dates:', dates)}
/>
<Calendar
selected={['2024-03-20', '2024-03-21', '2024-03-22']}
onChange={(dates) => console.log('Multiple dates:', dates)}
defaultMonth={3}
defaultYear={2024}
/>
<Calendar
selected={[]}
disabled={['2024-03-10', '2024-03-11']}
minDate="2024-03-01"
maxDate="2024-03-31"
onChange={(dates) => console.log('Constrained dates:', dates)}
/>
</>
);
export default Examples;
Props
| Prop | Type | Description |
|---|---|---|
day |
number |
The number of the day currently focused |
defaultDay |
number |
Sets the default value for day |
defaultMonth |
number |
Sets the default value for month |
defaultPreviouslySelected |
string[] |
Sets the default value for previouslySelected |
defaultSelected |
string[] |
Sets the default value for selected |
defaultYear |
number |
Sets the default value for year |
disabled |
string[] |
Takes an array of dates as string in the format 'YYYY-MM-DD' |
disabledDateFilter |
(date: string) => boolean |
A filter function that takes a date string in the format 'YYYY-MM-DD' and returns true if that date should be disabled |
locale |
string |
BCP 47 language tag (e |
maxDate |
string |
The latest enabled date |
minDate |
string |
The earliest enabled date |
month |
number |
The number of the month (from 1 to 12) which the calendar should be on |
nextMonthLabel |
string |
The aria-label attribute associated with the next month arrow, to describe it to assistive technology |
onBlur |
(event: FocusEvent<Element, Element>) => void |
Function which is called when the calendar is no longer focused |
onChange |
(event: ChangeEvent, analyticsEvent: UIAnalyticsEvent) => void |
Called when the calendar is navigated |
onFocus |
(event: FocusEvent<Element, Element>) => void |
Called when the calendar receives focus |
onSelect |
(event: SelectEvent, analyticsEvent: UIAnalyticsEvent) => void |
Function called when a day is clicked on |
previouslySelected |
string[] |
Takes an array of dates as string in the format 'YYYY-MM-DD' |
previousMonthLabel |
string |
The aria-label attribute associated with the previous month arrow, to describe it to assistive technology |
selected |
string[] |
Takes an array of dates as string in the format 'YYYY-MM-DD' |
shouldSetFocusOnCurrentDay |
boolean |
This allows the calendar to automatically set the focus to the current day |
tabIndex |
0 | -1 |
Indicates if the calendar can be focused by keyboard or only |
| programmatically | ||
today |
string |
Value of current day, as a string in the format 'YYYY-MM-DD' |
weekStartDay |
0 | 1 | 2 | 3 | 4 | 5 | 6 |
Start day of the week for the calendar |
year |
number |
Year to display the calendar for |
사용 지침
- 날짜 선택 인터페이스에 사용해요.
- 날짜 범위 제한을 고려해요.
- 선택된 날짜에 대해 명확한 시각적 피드백을 제공해요.
- 비활성화된 날짜를 적절히 처리해요.
콘텐츠 지침
- 명확한 날짜 형식을 사용해요.
- 도움이 되는 날짜 라벨을 제공해요.
- 일관된 날짜 용어를 사용해요.
- 날짜 표시의 현지화를 고려해요(예: locale prop, 월/일 이름, 한 주의 첫 요일).
접근성 지침
- 명확한 날짜 선택 피드백을 제공해요.
- 날짜 사이의 키보드 이동을 보장해요.
- 날짜에 적절한 ARIA 라벨을 사용해요.
- 날짜 변경에 대한 스크린 리더 안내를 지원해요.