@mash-a/timepicker-react

1.0.9 • Public • Published

TimePicker

A React TimePicker component based on jquery-timepicker

Peer Dependencies

  • React (>= 16)
  • react-dom (>= 16)

Installation

npm i timepicker-react
yarn add timepicker-react

Usage

import * as React from 'react';
import { TimePicker } from "@mash-a/timepicker-react";

const options = {
	disableTextInput: 'bool',
	step: 'integer',
	timeFormat: 'string',
	enableSelect: 'bool'
}

const Demo = () => (
	const [timeString, setTimeString] = React.useState('');

	const handleChange = value => {
		setTimeString(value);
		// …
	}

	return (
		<TimePicker
			value={timeString}
			onChange={handleChange} 
			options={options}
			/>
	)
);

Options

  • disableTextInput Prevents the user from using the input and the dropdown. Primarily for displaying time. default: false

  • step
    The amount of time, in minutes, between each item in the dropdown. default: 30

  • timeFormat Use php's date formatting syntax default: 'g:ia'

Package Sidebar

Install

npm i @mash-a/timepicker-react

Weekly Downloads

0

Version

1.0.9

License

MIT

Unpacked Size

130 kB

Total Files

8

Last publish

Collaborators

  • mash-a