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

@gfazioli/mantine-clock

v2.1.9

Published

React Clock components and hooks for Mantine with timezone support, countdown timers, customization options, and real-time updates.

Downloads

671

Readme

Mantine Clock Component

NPM version NPM Downloads NPM Downloads NPM License

Overview

This component is created on top of the Mantine library.

Mantine UI Library

It provides the capability to generate a dynamic clock effect, enabling the display of a wide variety of content in a visually engaging manner. This effect can enhance the overall user experience by drawing attention to important information, announcements, or promotions, allowing for a more interactive and captivating presentation.

Mantine Extensions Demo and Documentation Mantine Extensions HUB

👉 You can find more components on the Mantine Extensions Hub library.

Installation

npm install @gfazioli/mantine-clock

or

yarn add @gfazioli/mantine-clock

After installation import package styles at the root of your application:

import '@gfazioli/mantine-clock/styles.css';

Usage

The Mantine Clock library provides powerful components and hooks for time management and visualization in React applications using Mantine.

Clock Component

Create analog clocks with real-time updates or static time display:

import { Clock } from '@gfazioli/mantine-clock';

// Real-time clock
function LiveClock() {
  return <Clock />;
}

// Static clock showing specific time
function StaticClock() {
  return <Clock value={new Date('2023-12-25T15:30:00')} running={false} />;
}

// Customized clock with timezone
function WorldClock() {
  return (
    <Clock 
      timezone="America/New_York"
      size={200}
      hourHandColor="blue"
      minuteHandColor="cyan"
      secondHandColor="red"
    />
  );
}

useClock Hook

Get real-time time data with flexible formatting:

import { useClock } from '@gfazioli/mantine-clock';

function DigitalClock() {
  const { hours, minutes, seconds, amPm, isRunning } = useClock({
    timezone: 'UTC',
    use24Hours: false,
    padHours: true,
    padMinutes: true,
    padSeconds: true
  });

  return (
    <div>
      {hours}:{minutes}:{seconds} {amPm}
    </div>
  );
}

useClockCountDown Hook

Create countdown timers with target dates or durations:

import { useClockCountDown } from '@gfazioli/mantine-clock';

// Countdown to specific date
function EventCountdown() {
  const { day, hours, minutes, seconds } = useClockCountDown({
    targetDate: new Date('2024-12-31T23:59:59'),
    onCountDownCompleted: () => alert('Happy New Year!')
  });

  return (
    <div>
      Time remaining: {day}d {hours}h {minutes}m {seconds}s
    </div>
  );
}

// Countdown from duration
function TimerCountdown() {
  const { minutes, seconds, isRunning } = useClockCountDown({
    minutes: 25, // 25-minute Pomodoro timer
    onCountDownCompleted: () => console.log('Break time!')
  });

  return (
    <div>
      Pomodoro: {minutes}:{seconds}
    </div>
  );
}

Styling and Theming

The library integrates seamlessly with Mantine's theming system:

import '@gfazioli/mantine-clock/styles.css';
// or with CSS layers
import '@gfazioli/mantine-clock/styles.layer.css';

// Custom styled clock with available CSS variables
function ThemedClock() {
  return (
    <Clock 
      style={{
        '--clock-color': 'var(--mantine-color-blue-1)',
        '--clock-hour-ticks-color': 'var(--mantine-color-blue-6)',
        '--clock-minute-ticks-color': 'var(--mantine-color-blue-4)',
        '--clock-primary-numbers-color': 'var(--mantine-color-blue-9)',
        '--clock-secondary-numbers-color': 'var(--mantine-color-blue-7)',
        '--clock-hour-hand-color': 'var(--mantine-color-blue-8)',
        '--clock-minute-hand-color': 'var(--mantine-color-blue-6)',
        '--clock-second-hand-color': 'var(--mantine-color-red-6)'
      }}
      className="my-custom-clock"
    />
  );
}

Advanced Examples

// Multi-timezone dashboard
function WorldClockDashboard() {
  const timezones = [
    { name: 'New York', tz: 'America/New_York' },
    { name: 'London', tz: 'Europe/London' },
    { name: 'Tokyo', tz: 'Asia/Tokyo' }
  ];

  return (
    <div style={{ display: 'flex', gap: '2rem' }}>
      {timezones.map(({ name, tz }) => (
        <div key={tz}>
          <h3>{name}</h3>
          <Clock timezone={tz} size={150} />
        </div>
      ))}
    </div>
  );
}

// Clock with custom number visibility and styling
function CustomNumbersClock() {
  return (
    <Clock 
      primaryNumbersOpacity={1}
      secondaryNumbersOpacity={0.5}
      primaryNumbersColor="blue"
      secondaryNumbersColor="gray"
      size={200}
    />
  );
}

// Countdown with controls
function ControllableCountdown() {
  const countdown = useClockCountDown({
    minutes: 10,
    enabled: false
  });

  return (
    <div>
      <div>{countdown.minutes}:{countdown.seconds}</div>
      <button onClick={countdown.start}>Start</button>
      <button onClick={countdown.pause}>Pause</button>
      <button onClick={countdown.resume}>Resume</button>
      <button onClick={countdown.reset}>Reset</button>
    </div>
  );
}

Features

  • Real-time Updates: Automatic time synchronization with configurable frequency
  • Timezone Support: Global timezone compatibility with IANA timezone database
  • Customizable Styling: Full control over appearance and theming
  • TypeScript Support: Complete type definitions for better developer experience
  • Accessibility: Built with WCAG compliance and screen reader support
  • Performance Optimized: Efficient updates with minimal re-renders
  • Responsive Design: Adapts to different screen sizes automatically

Star History Chart

https://github.com/user-attachments/assets/727a8634-28ee-4279-80b1-dcf2cb7f5961