Socket
Socket
Sign inDemoInstall

@trickl/mui-daterange-picker

Package Overview
Dependencies
89
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @trickl/mui-daterange-picker

A react date range picker implementation using @mui.


Version published
Maintainers
1
Created

Readme

Source

MUI DateRange Picker

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

Latest npm version

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
}

interface SelectComment {
    start: string,
    end: string,
}

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)
maskstringoptionaldd MMMM yyyythe date format shown in the header
selectCommentSelectCommentoptional{start: 'Start Date', end: 'End Date'}initially comment shown in the header

Made possible by

Keywords

FAQs

Last updated on 01 Jul 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc