Skip to content

mash-a/timepicker-react

 
 

Repository files navigation

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:i A'

About

A React TimePicker component based on jquery-timepicker

Resources

License

Stars

Watchers

Forks

Languages

  • JavaScript 91.2%
  • CSS 8.8%