2.1.0 • Published 6 years ago

react-awesome-date v2.1.0

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

React-awesome-date

npm.io

Installation


via NPM

npm i react-awesome-date

via Yarn

yarn add react-awesome-date

via CDN (unpkg)

https://unpkg.com/react-awesome-date@latest/dest/react-awesome-date.js

Be sure to include the style sheet. It is located in the /styles folder. You must use two css files. One for calendar styles, and one for the styles user interface

import "react-awesome-date/styles/index.css"
import "react-awesome-date/styles/ui_default.css"

Or

<link rel="stylesheet" href="https://unpkg.com/react-awesome-date@latest/index.css">
<link rel="stylesheet" href="https://unpkg.com/react-awesome-date@latest/ui_default.css">

Usage

import Date from 'react-awesome-date';

<Date year={1998} month={3} />

By default, the date will be inserted for the current month and year

<Date />

Event

Get the selected date using onSelect

function onSelect(date){
	// ...
}
<Date onSelect={onSelect}/>

Custom render

Organize your own rendering or use ready-made samples

import {headerRenderer as input} from 'react-awesome-date/ui/input';
import "react-awesome-date/styles/ui_input.css";

<Date headerRenderer={input}/>

The result is npm.io

import {headerRenderer as onlymonth} from 'react-awesome-date/ui/onlymonth';
import "react-awesome-date/styles/ui_onlymonth.css";

<Date headerRenderer={onlymonth}/>

The result is npm.io

Make your custom renderer