0.1.4 • Published 5 years ago

react-styled-calendar v0.1.4

Weekly downloads
2
License
MIT
Repository
github
Last release
5 years ago

React-Styled-Calendar

style size codeStyle document

A simple React Datepicker component built with styled-components and date-fns

DEMO

DatePicker datepickerDemo

RangePicker rangepickerDemo

Play with them on Storybook

Installation

npm install react-styled-calendar --save

Example Usage

import react from 'react';
import ReactDOM from 'react-dom';
import { DatePicker } from 'react-styled-calendar';


function App() {
  return (
    <div>
      <DatePicker />
    </div>
  );
}

const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);

Feature

  • support IE9+, Chrome, Firefox, Safari, and Opera
  • support en_US and zh_CN locale(UI)
  • support several select panels(hour, date, week, month)
  • support Range Selector

API

API for DatePicker

nametypedefaultdescription
showTimeSelectorBooleanfalsecontrol the display of the TimeSelector
showConfirmButtonBooleanfalsecontrol the display of the Confirm Button
showCancelButtonBooleantruecontrol the display of the Cancel Button
formatWeekString'dddd'A string used to override the default formattting of the weekday in the Calendar Header
formatMonthYearString'MMMM YYYY'A string used to override the default formatting of the month and year in Calendar Header
formatDateInputString'YYYY-MM-DD HH:mm'A string used to specify the format of the date in dateinput component
confirmButtonMessageString'Confirm'A string specify the message shows up at the confirm button
cancelButtonMessageString'Cancel'A string specify the message shows up at the cancel button
timeSelectorMessageString'Pick Up A Time !'A string specify the content of the switch of the time selector
withLabelBooleanfalseWhether show up the label of the Date input
labelMessageString'Date'The content of the date input label
minDateDateundefinedThe minimum date that can be selected from the calendar
maxDateDateundefinedThe maximum date that can be selected from the calendar
onDateSelectedFunction( dateSelected ) => { console.log(dateSelected.toLocaleDateString()) };The handler function which is called once a date is selected
viewString'day'It specifies the view of the datepicker, it can be one of 'day', 'week', 'month'
defaultDateDatenew Date()It specifies the initial selected date of the DatePicker component

API for RangePicker

nametypedefaultdescription
minDateDateundefinedThe minimum date that can be selected from the calendar
maxDateDateundefinedThe maximum date that can be selected from the calendar
classNameString''The customized className which is used on the wrapper of the RangePicker
withLabelBooleanfalseWhether show up the label of the Date input
fromInputLabelString'From'Specify the content of the first date input label
toInputLaelString'To'Specify the content of the second date input label
onRangeSelectedFunction(from, to) => { console.log(from, to); }The handler function which is called once a range is selected
defaultFromDateDatenew Date()Specify the initial selected date of the first (from) input
defaultToDateDatenew Date()Specify the initial selected date of the second (to) input

Todos

  • Implement the customized theme.
  • test
0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago