CalendarA calendar component for selecting dates and date ranges.
The Calendar components provide flexible date selection functionality with support for single dates, date ranges, and custom triggers.
Install the component from your command line.
The
Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
Su | Mo | Tu | We | Th | Fr | Sa |
---|---|---|---|---|---|---|
npm install @raystack/apsara
import { Calendar, RangePicker, DatePicker } from '@raystack/apsara' // Basic Calendar <Calendar numberOfMonths={2} /> // Range Picker with custom trigger <RangePicker> {({ startDate, endDate }) => ( <button> {startDate} - {endDate} </button> )} </RangePicker> // Date Picker with custom trigger <DatePicker> {({ selectedDate }) => ( <button> Selected: {selectedDate} </button> )} </DatePicker>
Calendar
component accepts the following props:
numberOfMonths
: Number of months to displaycaptionLayout
: Layout for the month caption (e.g., "dropdown")loadingData
: Boolean to show loading statedateInfo
: Object containing date-specific information like icons and textshowOutsideDays
: Boolean to show days from previous/next monthsclassName
: Additional CSS class names
RangePicker
component accepts the following props:
dateFormat
: Format for displaying the date (e.g., "DD/MM/YYYY")onSelect
: Callback function when date range is selectedvalue
: Initial date range valuecalendarProps
: Props for customizing the calendartextFieldProps
: Props for customizing the text fieldchildren
: Render prop for custom triggershowCalendarIcon
: Boolean to show/hide calendar icon (default: true)
DatePicker
component accepts the following props:
textFieldProps
: Props for customizing the text fieldchildren
: Render prop for custom triggershowCalendarIcon
: Boolean to show/hide calendar icon (default: true)
loading...
loading...
loading...