Code Monkey home page Code Monkey logo

material-duration-picker's Introduction

Material-Duration-Picker

Simple duration picker inspired by Material-UI Pickers

image

To install

npm install --save material-duration-picker

or

yarn add material-duration-picker

Dependencies:

To use:

This example uses date-fns to format the duration

import {DurationPicker} from "./durationPicker";
import {formatDuration} from 'date-fns'

const Comp = () => {
  const [value, setValue] = useState(0)
  return (
    <div>
      <DurationPicker
        label='Duration'
        value={value}
        onValueChange={(v) => setValue(v)}
        formatDuration={formatDuration}
      />
    </div>
  );
}
material-duration-picker-demo.mp4

Props

  • value: (REQUIRED) The duration value in seconds
  • onValueChange: (REQUIRED) On change callback
  • formatDuration: function to customize the way that the duration is formatted
  • views: Array of views to offer. MUST BE FROM BIGGEST TO SMALLEST ex: ['weeks', 'minutes', 'seconds']
  • disableEditDialog: If should not enable the edit dialog on click of the field
  • DurationDialogProps: Props passed to the dialog

Remaining props are passed to the TextField component

Localisation

#1 (comment)

Sandbox example

material-duration-picker's People

Contributors

tran-simon avatar

Stargazers

 avatar

Watchers

 avatar

material-duration-picker's Issues

Localization

Is there a way to change localization from English to other languages please?
If so, could you please provide some example?
Thank you

Mui v5

Any chance there will be support for v5?

Getting an error trying to compile.

Module not found: Error: Can't resolve '@material-ui/core'

Which makes sense since @material-ui/core has been moved to @mui/material.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.