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

clock-analog-digital-react

v1.0.11

Published

A reusable React clock package with analog and digital clocks

Readme

Clock React Component (lightweight and customizable)

clock-analog-digital-react is a React component that provides two modes for displaying a clock: Analog and Digital. All inner components are customizable by the user, and you can easily configure your desired clock.

You can view a live demo and configure your clock here.

Installation

To install the package, run the following command:

npm i clock-analog-digital-react

Importing the Component

You can import the Clock component into your React project like this:

import Clock from 'clock-analog-digital-react';

Usage

Analog Clock

To display the analog clock, set the clockMode prop to 'analog'.

import Clock from 'clock-analog-digital-react';

const App = () => {
  return (
    <Clock clockMode="analog" />
  );
};

export default App;

Digital Clock

To display the digital clock, set the clockMode prop to 'digital'.

import Clock from 'clock-analog-digital-react';

const App = () => {
  return (
    <Clock clockMode="digital" />
  );
};

export default App;

Props

Below is a list of available props for both Analog and Digital clocks. The clockMode prop must be either 'analog' or 'digital'.

| Prop Name | Type | Description | |-------------------------------|-------------------------------------------|-----------------------------------------------------------------------------| | clockMode | 'analog' \| 'digital' | Mode for the clock. Choose either 'analog' or 'digital'. |

Analog Clock Props

| Prop Name | Type | Description | |-------------------------------|-------------------------------------------|-----------------------------------------------------------------------------| | colorConfiguration | AnalogClockColorConfiguration | Defines the color configuration for the analog clock. | | clockBorderThickness | number | Defines the thickness of the analog clock's border. | | clockNumbersType | string | Defines the numbering system for the analog clock (e.g., 'ENGLISH', 'ROMAN'). | | clockLogoSrcAndOffset | { cmp: React.ReactNode; offset: number } | Defines a logo component and its offset position on the analog clock. | | hasPrimaryTicks | boolean | Whether the analog clock shows primary ticks (default: false). | | hasMajorTicks | boolean | Whether the analog clock shows major ticks (default: false). | | hasMinorTicks | boolean | Whether the analog clock shows minor ticks (default: false). | | hasPrimaryNumbers | boolean | Whether the analog clock shows primary numbers (default: false). | | hasMajorNumbers | boolean | Whether the analog clock shows major numbers (default: false). | | majorNumbersFontSize | number | Defines the font size for major numbers on the analog clock. | | primaryNumbersFontSize | number | Defines the font size for primary numbers on the analog clock. | | UserPrimaryTicksComponent | React.ReactNode | Custom component for primary ticks. | | UserMajorTicksComponent | React.ReactNode | Custom component for major ticks. | | UserMinorTicksComponent | React.ReactNode | Custom component for minor ticks. | | PrimaryNumbersComponent | React.ReactNode | Custom component for primary numbers. | | MajorNumbersComponent | React.ReactNode | Custom component for major numbers. | | ClockCenterComponent | React.ReactNode | Custom component for the clock center. |

Digital Clock Props

| Prop Name | Type | Description | |-------------------------------|-------------------------------------------|-----------------------------------------------------------------------------| | colorConfiguration | DigitalClockColorConfiguration | Defines the color configuration for the digital clock. | | twentyFourHours | boolean | Whether the digital clock shows in 24-hour format (default: false). | | padding | number | Defines the padding around the digital clock. |


Color Configuration

The colorConfiguration prop changes depending on whether the clock is set to Analog or Digital mode.

AnalogClockColorConfiguration

This configuration controls various aspects of the analog clock's appearance, including the colors of the hands, numbers, ticks, and the clock background. Here's a detailed list of the available fields:

| Prop Name | Type | Description | |-----------------------------|---------|----------------------------------------------------------------------| | clockBackgroundColor | string| Defines the background color of the analog clock. | | clockBorderColor | string| Defines the color of the analog clock's border. | | hourHandColor | string| Defines the color of the hour hand. | | minuteHandColor | string| Defines the color of the minute hand. | | secondHandColor | string| Defines the color of the second hand. | | majorNumbersColor | string| Defines the color of the major numbers on the clock. | | primaryNumbersColor | string| Defines the color of the primary numbers on the clock. | | primaryTicksColor | string| Defines the color of the primary ticks on the clock. | | majorTicksColor | string| Defines the color of the major ticks on the clock. | | minorTicksColor | string| Defines the color of the minor ticks on the clock. | | centerCircleColor | string| Defines the color of the center circle of the analog clock. | | alarmRingColor | string| Defines the color of the alarm ring (if any). |

DigitalClockColorConfiguration

This configuration controls the colors specific to the digital clock's segments and display. Here's a breakdown:

| Prop Name | Type | Description | |-----------------------------|---------|----------------------------------------------------------------------| | backgroundColor | string| Defines the background color of the digital clock. | | activeSegmentColor | string| Defines the color of the active segments in the digital display. | | inactiveSegmentColor | string| Defines the color of the inactive segments in the digital display. | | dotsColor | string| Defines the color of the dots (used for separating hours, minutes, etc.). | | alarmRingColor | string| Defines the color of the alarm ring for the digital clock. |


Support:

For support contact: [email protected]