0.0.46 • Published 5 years ago
react-dates-lite v0.0.46
react-dates-lite
Install
yarn add styled-components
- peerDependency, also check that you have react
and react-dom
yarn add react-dates-lite
API
Example
import Calendar from "react-dates-lite";
<Calendar
visibleMonths={1}
firstMonth={new Date(2018, 1, 1)}
lastMonth={new Date(2018, 2, 1)}
selectedDates={[new Date()]}
selectDates={console.log}
/>;
Props
visibleMonths?: number
- how many months will be visible (default1
)firstMonth: Date
- first month in calendar, months between first and last (included) will be in calendarlastMonth: Date
- last month in calendar, months between first and last (included) will be in calendarselectDates: Date[] => any
- will receive array of Dates that were selectedselectedDates: Date[]
- array of Dates that are selecteddisabledDates: Date[]
- array of Dates that cannot be selectedallowedDates?: Date[]
- array of dates that are selectable (default[]
) when it's empty, all dates are selectable (except disabled dates)future?: boolean
- if future dates from today will be enabled (defaulttrue
)past?: boolean
- if past dates from today will be enabled (defaulttrue
)rangeSelect?: boolean
- if enabled, ranges can be selected, otherwise just one date (defaulttrue
)className?: string
- will provide class to the Calendar container (default''
)colors?: { [string]: number }
- will provide colors to these stuff:selected
- background-color of selected dateselectedHover
- background-color of selected date that is hoveredhover
- background-color of date that is hoveredborder
- border colorbackground
- default background-colordisabled
- color of disabled date- default values:
colors = { selected: "rgb(244, 114, 49)", selectedHover: "rgb(255, 141, 74)", border: "#e4e7e7", background: "white", hover: "#e4e7e7", disabled: "gray" };
classes?: { [string]: string }
- will provide colors to these stuff:button
- class for buttonscalendarWrapper
- class for calendar wrappermonth
- class for single month wrapperday
- class for dayweekDay
- class for weekDaymonthName
- class for monthName- default value:
{}
customClasses?: { [className: string]: Date[] }
- addclassName
to specified datesCustomTd?: React.ComponentType<CalendarDayProps>
- custom day component (originalCalendarDay
)showMonthName: boolean
- show / hide month namesshowWeekDayNames: boolean
- show / hide week day namesweekDayFormat?: string
- week day format, e.g.E
weekDayFormatter?: Date => string
- week day formatter function, e.g.day => format(day, 'E')
(can be used to pass locale)monthNameFormatter?: Date => string
- month name formatter function, e.g.month => format(month, 'MMMM yyyy')
(can be used to pass locale)width?: number
- custom base width of a single calendar (excluding margins)buttonBack?: React.Node
- custom back button (will receive disabled prop)buttonForward?: React.Node
- custom forwrad button (will receive disabled prop)firstWeekDay?: 0 | 1 | 2 | 3 | 4 | 5 | 6
- set day that will be displayed first (0
issunday
and also default value)
Contributing
PRs are welcome.
- install dependencies:
yarn
- develop with storybook:
yarn storybook
, or with webpack-dev-server:yarn start
License
MIT
0.0.46
5 years ago
0.0.45
6 years ago
0.0.44
6 years ago
0.0.43
6 years ago
0.0.42
6 years ago
0.0.41
6 years ago
0.0.40
6 years ago
0.0.39
6 years ago
0.0.38
6 years ago
0.0.37
6 years ago
0.0.36
7 years ago
0.0.35
7 years ago
0.0.34
7 years ago
0.0.33
7 years ago
0.0.32
7 years ago
0.0.31
7 years ago
0.0.30
7 years ago
0.0.29
7 years ago
0.0.28
7 years ago
0.0.27
7 years ago
0.0.26
7 years ago
0.0.25
7 years ago
0.0.24
7 years ago
0.0.23
7 years ago
0.0.22
7 years ago
0.0.21
7 years ago
0.0.20
7 years ago
0.0.19
7 years ago
0.0.18
7 years ago
0.0.17
7 years ago
0.0.16
7 years ago
0.0.15
7 years ago
0.0.14
7 years ago
0.0.13
7 years ago
0.0.12
7 years ago
0.0.11
7 years ago
0.0.10
7 years ago
0.0.9
7 years ago
0.0.8
7 years ago
0.0.7
7 years ago
0.0.6
7 years ago
0.0.5
7 years ago
0.0.4
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago