/react-pikaday-component

Universal React component wrapper around https://github.com/dbushell/Pikaday datepicker

Primary LanguageJavaScript

React Pikaday Component

npm version Dependency Status

Universal React component wrapper around Pikaday.js datepicker.

Install

npm install react-pikaday-component --save

Usage

import React from 'react';
import DatePicker from 'react-pikaday-component';

class App extends React.Component {
    state = {}

    onDateChange(date) {
        this.setState({ date });
    }

    render() {
        const { date } = this.state;

        return (
            <div>
                <DatePicker 
                    placeholder="Select Date"
                    format="YYYY/MM/DD"
                    maxDate={new Date('2016-07-26')}
                    value={new Date(date)}
                    onChange={::this.onDateChange}
                />
            </div>
        );
    }
}

React.render(
    <App />,
    document.getElementById('example')
);

Properties

  • value
  • onChange
  • valueLink
  • Pikaday configuration options (except onSelect and field)
  • other input attributes like className, placeholder, disabled and readOnly

MIT Licensed