1.0.2 • Published 6 months ago
@voytenkodev/react-datepicker v1.0.2
React DatePicker
Simple datepicker on React
Installation
npm install @voytenkodev/react-datepicker
Or via yarn:
yarn add @voytenkodev/react-datepicker
import { useState } from 'react'
import { CalendarPicker } from '@voytenkodev/react-datepicker'
// if need a default styles
import '@voytenkodev/react-datepicker/dist/style.css'
function App() {
const [date, setDate] = useState<Date>();
return (
<CalendarPicker value={date} onChange={setDate} />
)
}
Use with react-hook-form
import { CalendarPicker } from 'react-datepicker'
import { useFormContext, Controller } from 'react-hook-form'
// if need a default styles
import '@voytenkodev/react-datepicker/dist/style.css'
function App() {
const { control } = useFormContext()
return (
<Controller
control={control}
render={({ field: { onChange, value }}) => (
<CalendarPicker
value={value}
onChange={onChange}
/>
)}
name={'your-key'}
/>
)
}
Property | type | Values | Description | |
---|---|---|---|---|
locale | string | "en", "ru", "fr" | Changed language and day of started week. Default: en | |
type | String | "month", "full" | Type of returned date (when type of month, days is not show) | |
onChange* | Date | any date | Returned date or null (if reset) | |
showFormat | string | DD.MM.YYYY, YYYY/MM/DD | Show format in calendar, but returned anyway date | |
value* | Date | any date | undefined | Show date or placeholder |
placeholder | string | any string | default placeholder it's returnedFormat | |
globalStyles | CSSProperties | any styles | Styles for global container | |
calendarStyles | CSSProperties | any styles | Styles for calendar container | |
mainColor | string | any color | Color is active date. Default: #2F8DB3 | |
min | string | none, "2024-04-12" | Min date for select. Default: none | |
max | string | none, "2024-05-12" | Max date for select. Default: none |
Todos
- Tests
- Documentation
Please create a discussion if you have any comments or suggestions, thank you.
1.0.2
6 months ago
1.0.1
6 months ago
0.0.19
6 months ago
0.0.18
6 months ago
0.0.17
6 months ago
0.0.16
6 months ago
0.0.15
6 months ago
0.0.14
6 months ago
0.0.13
6 months ago
0.0.12
6 months ago
0.0.11
6 months ago
0.0.10
6 months ago
0.0.9
6 months ago
0.0.8
6 months ago
0.0.7
6 months ago
0.0.6
6 months ago
0.0.5
6 months ago
0.0.4
6 months ago
0.0.3
6 months ago
0.0.2
6 months ago
0.0.1
6 months ago