Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ambiot/material-ui-multiple-dates-picker

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ambiot/material-ui-multiple-dates-picker

Date Picker with multiple selection based on Material UI

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
252
increased by39.23%
Maintainers
1
Weekly downloads
 
Created
Source

MUI Multiple Dates Picker

[]

Lets user pick more than one date from the date picker.

Motivation

This is a fork of react-multiple-datepicker. I needed a date picker that is built on Material-UI and supports multiple dates selections, couldn't find one, so here it is!

Features

  • Based on Material-UI components with Dialog component being the root of it
  • Choose dates right from the calendar
  • See all selected dates on the list
  • Click on any selected date to remove it (either on calendar or on the list)
  • Customize button labels and titles
  • Its appearance is based on your configuration of Material-UI theme

Installation

To install the component run this command:

npm i -S @ambiot/material-ui-multiple-dates-picker react @mui/material @mui/lab @mui/icons-material @emotion/styled @emotion/react

Usage example

import MultipleDatesPicker from '@ambiot/material-ui-multiple-dates-picker'

const Example = () => {
  const [open, setOpen] = useState(false)

  return (
    <div>
      <Button onClick={() => setOpen(!open)}>
        Select Dates
      </Button>
      <MultipleDatesPicker
        open={open}
        selectedDates={[]}
        onCancel={() => setOpen(false)}
        onSubmit={dates => console.log('selected dates', dates)}
      />
    </div>
  )
}

API

MultipleDatesPicker (default export)

Prop NameTypeDefaultDescription
openbool, requiredfalseIs Date Picker Dialog open or not
selectedDatesArray of Date[]MultipleDatesPicker uses its own internal array of selected date and sends it only when user clicks Submit button. But you can still use this variable to pass initial value to it — array will be copied.
disabledDatesArray of DatenullAn array of dates to disable. They will appear gray and user won't be able to select them.
onCancelfunc, requirednullFires when user clicks Cancel button. You need to handle closing the picker when this handler fires.
onSubmitfunc, requirednullFires when user clicks Submit button with only one parameter: array of selected Dates: onSubmit(selectedDates). You need to handle closing the picker when this handler fires.
readOnlyboolfalseIs Date Picker interactive. Use this if you just want to display dates to the user. Submit button will be hidden and onCancel will be fired when user presses "Dismiss" button.
cancelButtonTextstringif readOnly then "Dismiss" is not then "Cancel"Cancel button title
submitButtonTextstringSubmitSubmit button title
selectedDatesTitlestringSelected DatesSelected dates list header title
DialogPropsobject{}properties for the Dialog component. See more

To-Do

  • Add locale support

Changelog of version 1.0.2

  1. Migrated to react 18 and mui 5.
  2. React and mui moved to peerDependencies.
  3. Added DialogProps property, now you can forward properties for the Dialog component.

Contributing

I don't have enough time to maintain this library, so pull requests will be greatly appreciated!

  1. Clone the repository: git clone https://github.com/randex/material-ui-multiple-dates-picker.git
  2. Get inside the folder: cd material-ui-multiple-dates-picker
  3. Install all the general dependencies: npm i
  4. Get inside the app folder: cd app
  5. Install all dependencies needed to launch the demo app: npm i
  6. Run npm start to launch the demo app.
  7. Library is located under app/src/lib. Edit the code and watch the changes in the browser.

Happy coding and thank you for your help!

Keywords

FAQs

Package last updated on 19 Oct 2022

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc