npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

timepick-kit-react

v0.0.5

Published

A flexible timepicker kit for react

Readme

TimePick Kit React

A flexible and customizable time picker component for React applications with built-in popover support.

Features

🎨 Fully customizable styling via Tailwind CSS
🔄 Smooth animations with Framer Motion
⌨️ Keyboard navigation support
🎯 Click outside detection
🌗 Light/Dark mode support
📱 Mobile-friendly design
⚡ Lightweight and performant
🔌 Easy integration

Installation

npm install timepick-kit-react

Required Peer Dependencies

The following packages are required as peer dependencies:

{
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
  "date-fns": "^2.30.0",
  "framer-motion": "^10.12.16",
  "lucide-react": "^0.244.0",
  "clsx": "^1.2.1",
  "tailwind-merge": "^1.12.0"
}

Basic Usage

import { useState } from "react";
import {
  Popover,
  PopoverTrigger,
  PopoverContent,
  PopoverButton,
  TimePicker,
  TimeInput,
} from "timepick-kit-react";
import "timepick-kit-react/index.css";

function App() {
  const [time, setTime] = useState<TimeInput>(new Date());

  return (
    <Popover>
      <PopoverTrigger>
        <PopoverButton time={time} />
      </PopoverTrigger>
      <PopoverContent>
        <TimePicker value={time} onChange={(newTime) => setTime(newTime)} />
      </PopoverContent>
    </Popover>
  );
}

Components API

TimePicker

Main component for time selection.

| Prop | Type | Default | Description | | ----------------------- | ---------------------- | ------------- | ------------------------------------------------- | | value | TimeInput | required | Current time value (Date, string, or Time object) | | onChange | (time: Time) => void | required | Callback when time changes | | toggle | () => void | optional | Function to close picker | | timepickerClassName | string | optional | Custom class for picker container | | buttonClassName | string | optional | Custom class for increment/decrement buttons | | sectionClassName | string | optional | Custom class for hour/minute sections | | inputClassName | string | optional | Custom class for time input fields | | periodToggleClassName | string | optional | Custom class for AM/PM toggle | | closeButtonClassName | string | optional | Custom class for close button | | incrementIcon | LucideIcon | ChevronUp | Custom icon for increment button | | decrementIcon | LucideIcon | ChevronDown | Custom icon for decrement button | | closeIcon | LucideIcon | X | Custom icon for close button |

Popover Components

<Popover />

Container component that manages popover state.

| Prop | Type | Default | Description | | ----------- | ----------- | ------------ | -------------------------- | | children | ReactNode | required | Popover content components | | className | string | optional | Additional CSS classes |

<PopoverTrigger />

Trigger element that toggles the popover.

| Prop | Type | Default | Description | | ----------- | ----------- | ------------ | ----------------------------- | | children | ReactNode | required | Element that triggers popover | | className | string | optional | Additional CSS classes |

<PopoverContent />

Content container for the popover.

| Prop | Type | Default | Description | | ----------- | ------------- | --------------------------------------- | -------------------------------- | | children | ReactNode | required | Content to display in popover | | className | string | optional | Additional CSS classes | | isAnimate | boolean | true | Enable/disable animations | | variants | MotionProps | Default Animation | Framer Motion animation variants |

Default Animation
{
  initial: { opacity: 0, y: "20%" },
  animate: { opacity: 1, y: "5%" },
  exit: { opacity: 0, y: "-20%" },
  transition: { duration: 0.2 }
}

Types

TimeInput

type TimeInput = Date | string | Time;

interface Time {
  hour: number; // 1-12
  minute: number; // 0-59
  period: "AM" | "PM";
}

Styling

The package uses Tailwind CSS for styling.
Import import "timepick-kit-react/index.css"; into your app component.

Utility Functions

formatTime

import { formatTime } from "timepick-kit-react";

const timeString = formatTime(new Date()); // Returns "hh:mm a" format

useTimePicker

import { useTimePicker } from "timepick-kit-react";

const { time, setHour, setMinute, setPeriod } = useTimePicker(initialValue);

useClickOutside

import { useClickOutside } from "timepick-kit-react";

useClickOutside(ref, handleClickOutside);

Features

Keyboard Navigation

  • Up/Down arrows: Increment/decrement values
  • Enter: Confirm selection
  • Tab: Navigate between inputs
  • Escape: Close picker

Customization

  • Custom icons support
  • Flexible styling with Tailwind CSS
  • Animation customization via Framer Motion
  • Light/Dark mode theming

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Created by David Jaja