1 | <h1 align="center">Material-UI pickers</h1>
|
2 |
|
3 | <div align="center">
|
4 |
|
5 | Accessible, customizable, delightful date & time pickers for [@material-ui/core](https://material-ui.com/)
|
6 |
|
7 | [![npm package](https://img.shields.io/npm/v/@material-ui/pickers.svg)](https://www.npmjs.org/package/@material-ui/pickers)
|
8 | [![npm download](https://img.shields.io/npm/dm/@material-ui/pickers.svg)](https://www.npmjs.org/package/@material-ui/pickers)
|
9 | [![codecov](https://codecov.io/gh/mui/material-ui-pickers/branch/next/graph/badge.svg)](https://codecov.io/gh/mui/material-ui-pickers)
|
10 | [![Bundle Size](https://badgen.net/bundlephobia/minzip/@material-ui/pickers)](https://bundlephobia.com/result?p=@material-ui/pickers@latest)
|
11 | [![CircleCI](https://circleci.com/gh/mui/material-ui-pickers.svg?style=svg)](https://circleci.com/gh/mui/material-ui-pickers)
|
12 | [![Cypress.io tests](https://img.shields.io/badge/cypress.io-tests-green.svg?style=flat-square)](https://dashboard.cypress.io/#/projects/qow28y/runs)
|
13 | [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/mui/material-ui-pickers)
|
14 | [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
|
15 |
|
16 | </div>
|
17 |
|
18 | > [!WARNING]
|
19 | > The docs website is not online anymore, you can still get access to it by cloning this repository and run `yarn dev`.
|
20 |
|
21 | ### Installation
|
22 |
|
23 | Note that this package requires `@material-ui/core` **v4**. It will not work with the old v3. Please read the [migration guide](/) if you are updating from v2
|
24 |
|
25 | ```sh
|
26 | // via npm
|
27 | npm i @material-ui/pickers
|
28 |
|
29 | // via yarn
|
30 | yarn add @material-ui/pickers
|
31 | ```
|
32 |
|
33 | Now choose the library that pickers will use to work with date. We are providing interfaces for [moment](https://momentjs.com/), [luxon](https://moment.github.io/luxon/), [dayjs](https://github.com/iamkun/dayjs) and [date-fns v2](https://date-fns.org/). If you are not using moment in the project (or don’t have it in the bundle already) we suggest using date-fns or luxon, because they are much lighter and will be correctly tree-shaked from the bundle. Note, that we are fully relying on [date-io](https://github.com/dmtrKovalenko/date-io) for supporting different libraries.
|
34 |
|
35 | ```sh
|
36 | npm i date-fns@next @date-io/date-fns
|
37 | // or
|
38 | npm i moment @date-io/moment
|
39 | // or
|
40 | npm i luxon @date-io/luxon
|
41 | // or
|
42 | npm i dayjs @date-io/dayjs
|
43 | ```
|
44 |
|
45 | Then teach pickers which library to use with `MuiPickerUtilsProvider`. This component takes a utils property, and makes it available down the React tree thanks to React context. It should preferably be used at the root of your component tree.
|
46 |
|
47 | ```jsx
|
48 | import MomentUtils from '@date-io/moment';
|
49 | import DateFnsUtils from '@date-io/date-fns';
|
50 | import LuxonUtils from '@date-io/luxon';
|
51 | import { MuiPickersUtilsProvider } from '@material-ui/pickers';
|
52 |
|
53 | function App() {
|
54 | return (
|
55 | <MuiPickersUtilsProvider utils={DateFnsUtils}>
|
56 | <Root />
|
57 | </MuiPickersUtilsProvider>
|
58 | );
|
59 | }
|
60 |
|
61 | render(<App />, document.querySelector('#app'));
|
62 | ```
|
63 |
|
64 | ## Documentation
|
65 |
|
66 | Check out the [documentation website](/)
|
67 |
|
68 | ### Recently updated?
|
69 |
|
70 | Changelog available [here](https://github.com/mui/material-ui-pickers/releases)
|
71 |
|
72 | ### Contributing
|
73 |
|
74 | For information about how to contribute, see the [CONTRIBUTING](https://github.com/mui/material-ui-pickers/blob/master/CONTRIBUTING.md) file.
|
75 |
|
76 | ### LICENSE
|
77 |
|
78 | The project is licensed under the terms of [MIT license](https://github.com/mui/material-ui-pickers/blob/master/LICENSE)
|