Code Monkey home page Code Monkey logo

material-ui-pickers's Introduction

Material-UI picker

Components, that implements material design date and time pickers for material-ui v1

Recently updated?

Changelog available here

Installation

Available as npm package

npm install material-ui-pickers -S

Usage

Here is a quick example of how to use this package

class App extends Component {
  state = {
    selectedDate: new Date(),
    selectedTime: new Date()
  }

  handleDateChange = date => {
    this.setState({ selectedDate: date })
  }

  handleTimeChange = time => {
    this.setState({ selectedTime: time })
  }

  render() {
    const { selectedDate, selectedTime } = this.state

    return (
      <div>
        <DatePicker
          value={selectedDate}
          onChange={this.handleDateChange}
        />

        <TimePicker
          value={selectedTime}
          onChange={this.handleDateChange}
        />
      </div>
    )
  }
}

Props documentation

Here is a list of available props

Datepicker

Prop Type Default Definition
value string, number, Date object, Moment object null Datepicker value
format string 'MMMM Do' Moment format string for input
autoOk boolean false Auto accept date on selection
disableFuture boolean false Disable future dates
animateYearScrolling boolean false Will animate year selection (note that will work for browser supports scrollIntoView api)
openToYearSelection boolean false Open datepicker from year selection
minDate string, number, Date object, Moment object '1900-01-01' Minimum selectable date
maxDate string, number, Date object, Moment object '2100-01-01' Maximum selectable date

Timepicker

Prop Type Default Definition
value string, number, Date object, Moment object null Timepicker value
format string 'MMMM Do' Moment format string for input
autoOk boolean false Auto accept time on selection

Known Issues

  1. 24 hour displaying for timepicker (now supporting only am/pm)
  2. DateTime picker (wrapper above date and time)

They would be added/fixed in one of the nearest release :)

Contributing

For information about how to contribute, see the CONTRIBUTING file.

LICENSE

The project is licensed under the terms of MIT license

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.