본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

캘린더 픽커 뷰

원문 보기 위키 갱신

캘린더 픽커 뷰 (CalendarPickerView)

캘린더 픽커 뷰(CalendarPickerView)는 날짜나 날짜 범위를 선택할 때 쓰는 콘텐츠 영역이에요. CalendarPicker의 내용 부분으로 동작해요.

출처: 문서

본문

날짜나 날짜 범위를 선택할 때 사용해요.

CalendarPickerView는 CalendarPicker의 콘텐츠 영역이에요.

데모

여기서는 가장 단순한 콘텐츠 영역만 보여줘요. 더 많은 사용법은 CalendarPicker에서 확인할 수 있어요.

CalendarPickerView

Props

Name Description Type Default Version
allowClear 다시 클릭했을 때 선택 해제를 허용할지 여부. boolean true
defaultValue 기본으로 선택된 날짜 또는 날짜 범위. Same as value prop. -
max 선택 가능한 범위의 최댓값. Date -
min 선택 가능한 범위의 최솟값. Date - -
onChange 선택된 날짜가 변경되었을 때 트리거됨. 선택 모드가 "single"일 때 (val: Date | null) => void. 선택 모드가 "range"일 때 (val: [Date, Date] | null) => void. -
renderTop 날짜 상단 정보를 렌더링하는 함수. ((date: Date) => ReactNode | null | undefined) | false - false: 5.38.0
renderBottom 날짜 하단 정보를 렌더링하는 함수. ((date: Date) => ReactNode | null | undefined) | false - false: 5.38.0
selectionMode 선택 모드. 이 prop이 설정되지 않으면 선택이 비활성화돼요. 'single' | 'range' -
shouldDisableDate 해당 날짜의 선택 가능 여부를 지정. min과 max 설정은 무시돼요. (date: Date) => boolean -
title 캘린더의 제목 React.ReactNode Date selection
value 선택된 날짜 또는 날짜 범위. 선택 모드가 "single"일 때 Date | null. 선택 모드가 "range"일 때 [Date, Date] | null -
weekStartsOn 주가 시작하는 요일. 'Monday' | 'Sunday' 'Sunday'
renderDate 날짜 렌더링 커스터마이즈. (date: Date) => ReactNode - 5.28.0

CSS Variables

아직 지원되지 않아요.

Ref

Name Description Type
jumpTo 지정한 페이지로 이동 (page: Page | ((page: Page) => Page)) => void
jumpToToday 오늘 페이지로 이동 () => void
getDateRange 날짜를 가져옴 [Date, Date]
type Page = { month: number; year: number }

Ref를 통해 캘린더의 페이지 넘김을 직접 제어할 수 있어요. 예를 들면:

// Jump to today's page
ref.current.jumpToToday()

// Jump to the specified year and month
ref.current.jumpTo({ year: 2021, month: 1 })

// Jump to three years later
ref.current.jumpTo(page => ({
  year: page.year + 3,
  month: page.month,
}))

더 알아보기

바닥판 형태로 날짜를 고르는 완성형 컴포넌트는 CalendarPicker 문서를 참고하세요. 기간 선택과 함께 자주 쓰이는 선택 UI는 Picker 계열 문서를 확인하세요.