1.0.2 • Published 5 months ago

@voytenkodev/react-datepicker v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

React DatePicker

Simple datepicker on React

npm.io

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'}
        />
	)
}
PropertytypeValuesDescription
localestring"en", "ru", "fr"Changed language and day of started week. Default: en
typeString"month", "full"Type of returned date (when type of month, days is not show)
onChange*Dateany dateReturned date or null (if reset)
showFormatstringDD.MM.YYYY, YYYY/MM/DDShow format in calendar, but returned anyway date
value*Dateany dateundefinedShow date or placeholder
placeholderstringany stringdefault placeholder it's returnedFormat
globalStylesCSSPropertiesany stylesStyles for global container
calendarStylesCSSPropertiesany stylesStyles for calendar container
mainColorstringany colorColor is active date. Default: #2F8DB3
minstringnone, "2024-04-12"Min date for select. Default: none
maxstringnone, "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

5 months ago

1.0.1

5 months ago

0.0.19

5 months ago

0.0.18

5 months ago

0.0.17

5 months ago

0.0.16

5 months ago

0.0.15

5 months ago

0.0.14

5 months ago

0.0.13

5 months ago

0.0.12

5 months ago

0.0.11

5 months ago

0.0.10

5 months ago

0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

5 months ago

0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago