Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Timer for React Radix UI

Countdown or stopwatch with controls.

Framework
UI library

Radix UI does not include this primitive, so this page uses the Ark UI component. The visuals match the Ark UI version.

00
Days
00
Hours
00
Minutes
00
Seconds

Installation

bunx --bun shadcn@latest add https://kit.dev/r/radix/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
typekeyof Time
AttributeType
CSS variableType
--valuestring

TimerPlay

button

PropType
AttributeType

TimerSeparator

div

PropType
AttributeType

remainingMsUntilDate

PropType
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

TimerRestart

button

PropType
AttributeType

useTimer

PropType