Skip to content
shadcn.io

shadcn.io is not affiliated with official shadcn/ui

Shadcn Timer for React and Tailwind

Countdown or stopwatch with controls.

00
Days
00
Hours
00
Minutes
00
Seconds

Installation

bunx --bun shadcn@latest add https://kit.dev/r/timer.json

Anatomy

Timer
├── TimerArea
├── TimerControl
├── TimerItem
│   ├── TimerItemValue
│   └── TimerItemLabel
├── TimerRestart
└── TimerSeparator

Usage

import {
  Timer,
  TimerArea,
  TimerItem,
  TimerItemGroup,
  TimerItemLabel,
  TimerSeparator,
} from "@/components/ui/timer";
<Timer autoStart>
  <TimerArea>
    <TimerItemGroup>
      <TimerItem type="days" />
      <TimerItemLabel>Days</TimerItemLabel>
    </TimerItemGroup>
    <TimerSeparator />
    <TimerItemGroup>
      <TimerItem type="hours" />
      <TimerItemLabel>Hours</TimerItemLabel>
    </TimerItemGroup>
    <TimerSeparator />
    <TimerItemGroup>
      <TimerItem type="minutes" />
      <TimerItemLabel>Minutes</TimerItemLabel>
    </TimerItemGroup>
    <TimerSeparator />
    <TimerItemGroup>
      <TimerItem type="seconds" />
      <TimerItemLabel>Seconds</TimerItemLabel>
    </TimerItemGroup>
  </TimerArea>
</Timer>

Accessibility

KeyDescription
Enter
Activate the focused control.
Space
Activate the focused control.

Demos

Controlled

Countdown

Countdown Date

Custom Separator

Interval

Orientation Horizontal

Orientation Vertical

Pomodoro

API Reference

Timer

div

PropType
AttributeType

TimerArea

div

PropType
AttributeType

TimerControl

div

PropType
AttributeType

TimerItem

div

PropType
AttributeType
CSS variableType

TimerRestart

button

PropType
AttributeType

TimerSeparator

div

PropType
AttributeType

remainingMsUntilDate

AttributeType

TimerItemGroup

div

PropType
AttributeType

TimerItemLabel

div

PropType
AttributeType

TimerActionTrigger

button

PropType
AttributeType

TimerPause

button

PropType
AttributeType

TimerResume

button

PropType
AttributeType

TimerStart

button

PropType
AttributeType

TimerReset

button

PropType
AttributeType

TimerPlay

AttributeType

useTimer

PropType