1.0.15 • Published 10 months ago

charlla-daterange-picker v1.0.15

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

MUI DateRange Picker

A react date range picker implementation using @mui (v5).

Preview

Screenshot

Live Demo

Check out the project running here!

Usage

npm install mui-daterange-picker --save

# or with yarn
yarn add mui-daterange-picker

Basic example

import React from "react";
import { DateRangePicker, DateRange } from "mui-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

interface DateRange {
    startDate?: Date,
    endDate?: Date
}

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

Props

NameTypeRequiredDefault valueDescription
onChange(DateRange) => voidrequired-handler function for providing selected date range
toggle() => voidrequired-function to show / hide the DateRangePicker
initialDateRangeDateRangeoptional{}initially selected date range
minDateDate or stringoptional10 years agomin date allowed in range
maxDateDate or stringoptional10 years from nowmax date allowed in range
definedRangesDefinedRange[]optional-custom defined ranges to show in the list
closeOnClickOutsidebooleanoptionaltruedefines if DateRangePicker will be closed when clicking outside of it
wrapperClassNameobjectoptionalundefineddefines additional wrapper style classes
localeLocale (from date-dns)optionalundefineddefines locale to use (from date-fns package)

Made possible by

1.0.15

10 months ago

1.0.14

10 months ago

1.0.13

10 months ago

1.0.12

10 months ago

1.0.11

10 months ago

1.0.10

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.0.7

10 months ago

1.0.6

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago