material-ui-pickers

Accessible, customizable, delightful date & time pickers for @material-ui/core

Github星跟蹤圖

Accessible, customizable, delightful date & time pickers for @material-ui/core

npm package
npm download
codecov
Bundle Size
CircleCI
Cypress.io tests
This project is using Percy.io for visual regression testing.
code style: prettier

Installation

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

// via npm
npm i @material-ui/pickers

// via yarn
yarn add @material-ui/pickers

Now choose the library that pickers will use to work with date. We are providing interfaces for moment, luxon, dayjs and date-fns v2. 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 for supporting different libraries.

npm i date-fns@next @date-io/date-fns
// or
npm i moment @date-io/moment
// or
npm i luxon @date-io/luxon
// or
npm i dayjs @date-io/dayjs

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.

import MomentUtils from '@date-io/moment';
import DateFnsUtils from '@date-io/date-fns';
import LuxonUtils from '@date-io/luxon';
import { MuiPickersUtilsProvider } from '@material-ui/pickers';

function App() {
  return (
    <MuiPickersUtilsProvider utils={DateFnsUtils}>
      <Root />
    </MuiPickersUtilsProvider>
  );
}

render(<App />, document.querySelector('#app'));

Documentation

Check out the documentation website

Recently updated?

Changelog available here

Contributing

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

LICENSE

The project is licensed under the terms of MIT license

主要指標

概覽
名稱與所有者mui/material-ui-pickers
主編程語言TypeScript
編程語言JavaScript (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2017-10-07 19:36:16
推送於2025-03-18 00:43:43
最后一次提交
發布數87
最新版本名稱v3.3.11 (發布於 2023-08-24 10:22:42)
第一版名稱v1.0.0-alpha.2 (發布於 )
用户参与
星數2.3k
關注者數52
派生數830
提交數2.2k
已啟用問題?
問題數1310
打開的問題數0
拉請求數722
打開的拉請求數0
關閉的拉請求數136
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?