# materialui-daterange-picker

> A react date range picker implementation using @material-ui.

Latest version **1.1.92** (published 2020-09-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install materialui-daterange-picker
pnpm add materialui-daterange-picker
yarn add materialui-daterange-picker
bun add materialui-daterange-picker
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.92 |
| Published | 2020-09-15 |
| First published | 2020-02-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=8 |
| Dependencies | 4 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 69 |
| Author | pedro-lb |
| Maintainers | pedrobini |
| Keywords | react, component, react-components, date-range, date, range, picker, material-design, material, typescript, npm, package |

## Links

- npm: https://www.npmjs.com/package/materialui-daterange-picker
- Repository: https://github.com/pedro-lb/materialui-daterange-picker
- Homepage: https://github.com/pedro-lb/materialui-daterange-picker#readme
- Issues: https://github.com/pedro-lb/materialui-daterange-picker/issues
- npm.io page: https://npm.io/package/materialui-daterange-picker

## Dependencies (4)

- [date-fns](https://npm.io/package/date-fns.md) ^1.30.1
- [classnames](https://npm.io/package/classnames.md) ^2.2.6
- [@material-ui/core](https://npm.io/package/@material-ui/core.md) ^4.9.4
- [@material-ui/icons](https://npm.io/package/@material-ui/icons.md) ^4.9.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.92 (latest) — 2020-09-15
- 1.1.91 — 2020-08-05
- 1.1.9 — 2020-08-01
- 1.1.8 — 2020-03-03
- 1.1.7 — 2020-02-28
- 1.1.6 — 2020-02-28
- 1.1.5 — 2020-02-28
- 1.1.4 — 2020-02-28
- 1.1.3 — 2020-02-28
- 1.1.2 — 2020-02-28
- 1.1.1 — 2020-02-28
- 1.1.0 — 2020-02-28
- 1.0.9 — 2020-02-28
- 1.0.8 — 2020-02-28
- 1.0.7 — 2020-02-28
- … 7 more at https://npm.io/package/materialui-daterange-picker/versions

## README

# Material UI DateRange Picker

A react date range picker implementation using @material-ui.

<a href='https://www.npmjs.com/package/materialui-daterange-picker'>
    <img src='https://img.shields.io/npm/v/materialui-daterange-picker.svg' alt='Latest npm version'>
</a>

## Preview

![Screenshot](/screenshot.png?raw=true "Screenshot")

## Live Demo

Check out the project running [here](https://codesandbox.io/s/materialui-daterange-picker-2p3f1?file=/src/App.js)!

## Usage

```bash
npm install materialui-daterange-picker --save

# or with yarn
yarn add materialui-daterange-picker
```

## Basic example
```tsx
import React from "react";
import { DateRangePicker, DateRange } from "materialui-daterange-picker";

type Props = {}

const App: React.FunctionComponent<Props> = props => {
  const [open, setOpen] = React.useState(false);
  const [dateRange, setDateRange] = React.useState<DateRange>({});

  const toggle = () => setOpen(!open);

  return (
    <DateRangePicker
      open={open}
      toggle={toggle}
      onChange={(range) => setDateRange(range)}
    />
  );
}

export default App;
```

## Types
```ts
interface DateRange {
    startDate?: Date,
    endDate?: Date
}

interface DefinedRange {
    label: string,
    startDate: Date,
    endDate: Date
}
```

## Props

Name | Type | Required | Default value | Description
:--- | :--- | :--- | :--- | :---
`onChange` | `(DateRange) => void` | _required_ | - | handler function for providing selected date range
`toggle` | `() => void` | _required_ | - | function to show / hide the DateRangePicker
`initialDateRange` | `DateRange` | _optional_ | `{}` | initially selected date range
`minDate` | `Date` or `string` | _optional_ | 10 years ago | min date allowed in range
`maxDate` | `Date` or `string` | _optional_ | 10 years from now | max date allowed in range
`definedRanges` | `DefinedRange[]` | _optional_ | - | custom defined ranges to show in the list
`closeOnClickOutside` | `boolean` | _optional_ | `true` | defines if DateRangePicker will be closed when clicking outside of it
`wrapperClassName` | `object` | _optional_ | `undefined` | defines additional wrapper style classes

## Made possible by

<a href="https://github.com/jungsoft/materialui-daterange-picker/graphs/contributors">
  <img src="https://contributors-img.web.app/image?repo=jungsoft/materialui-daterange-picker" />
</a>

---
_Source: https://npm.io/package/materialui-daterange-picker · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
