New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-timepicker-c

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

react-timepicker-c

A lightweight, accessible timepicker component for React with full keyboard navigation and CSS customization

latest
Source
npmnpm
Version
2.0.0
Version published
Maintainers
1
Created
Source

react-timepicker-c

A lightweight, accessible timepicker component for React with full keyboard navigation and CSS customization.

NPM Bundle Size License

Features

  • Zero dependencies - No moment.js or other bloated libraries
  • Accessible - WCAG 2.1 AA compliant with full keyboard navigation
  • 🎨 Customizable - Style via CSS custom properties
  • 📦 Tiny bundle - < 5KB minified + gzipped
  • 🔧 TypeScript - Full type definitions included
  • ⚛️ React 18/19 - Built for modern React

Installation

npm install react-timepicker-c

Quick Start

import { useState } from "react";
import { TimePicker } from "react-timepicker-c";
import "react-timepicker-c/styles.css";

function App() {
  const [time, setTime] = useState("");

  return (
    <TimePicker
      value={time}
      onChange={setTime}
      minTime="9:00am"
      maxTime="5:00pm"
      interval={30}
    />
  );
}

Props

PropTypeDefaultDescription
valuestringRequiredCurrent time value (e.g., "2:30pm")
onChange(time: string) => voidRequiredCallback when time changes
minTimestring"12:00am"Minimum selectable time
maxTimestring"11:59pm"Maximum selectable time
intervalnumber30Interval between options (minutes)
errorbooleanfalseShow error state
errorMessagestring"Please enter a valid time"Error message text
placeholderstring"Select time"Input placeholder
disabledbooleanfalseDisabled state
namestring-Input name attribute
idstring-Input id attribute
classNamestring-Additional CSS class
aria-labelstring-Accessible label

Customization

Customize the appearance using CSS custom properties:

.timepicker {
  --timepicker-bg: #1a1a1a;
  --timepicker-text: #ffffff;
  --timepicker-border: #333333;
  --timepicker-border-focus: #0ea5e9;
  --timepicker-hover-bg: #2a2a2a;
  --timepicker-selected-bg: #0ea5e9;
  --timepicker-selected-text: #ffffff;
  --timepicker-error: #f43f5e;
  --timepicker-radius: 8px;
  --timepicker-font-size: 16px;
}

Available CSS Variables

VariableDescription
--timepicker-bgBackground color
--timepicker-textText color
--timepicker-text-secondaryPlaceholder text color
--timepicker-borderBorder color
--timepicker-border-focusFocus border color
--timepicker-hover-bgOption hover background
--timepicker-selected-bgSelected option background
--timepicker-selected-textSelected option text color
--timepicker-errorError state color
--timepicker-radiusBorder radius
--timepicker-shadowDropdown shadow
--timepicker-font-familyFont family
--timepicker-font-sizeFont size
--timepicker-input-heightInput height
--timepicker-dropdown-max-heightMax dropdown height
--timepicker-z-indexDropdown z-index

Keyboard Navigation

KeyAction
Open dropdown / Move to next option
Open dropdown / Move to previous option
EnterSelect highlighted option
EscapeClose dropdown
TabClose dropdown and move focus

Utilities

The package also exports utility functions for advanced use cases:

import {
  parseTime,
  formatTime,
  generateTimeRange,
  isValidTime
} from "react-timepicker-c";

// Parse time string to { hours, minutes }
parseTime("2:30pm"); // { hours: 14, minutes: 30 }

// Format back to string
formatTime({ hours: 14, minutes: 30 }); // "2:30pm"

// Generate time options
generateTimeRange("9:00am", "5:00pm", 60);
// ['9:00am', '10:00am', '11:00am', ...]

// Validate time string
isValidTime("2:30pm"); // true

Migration from v1.x

Breaking Changes

  • React 18+ required - This version requires React 18 or 19
  • CSS import required - You must import the styles separately
  • Prop renames:
    • timeValuevalue
    • hasTimeErrorerror

Before (v1.x)

import TimePicker from "react-timepicker-c";

<TimePicker timeValue={time} onChange={handleChange} hasTimeError={hasError} />;

After (v2.x)

import { TimePicker } from "react-timepicker-c";
import "react-timepicker-c/styles.css";

<TimePicker value={time} onChange={handleChange} error={hasError} />;

License

MIT © nosisky

Keywords

react

FAQs

Package last updated on 06 Jan 2026

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