RITARENA
UI LibraryComponents

PhaseTimer

Countdown timer with progress bar and ARIA support.

Labeled countdown with a progress bar. Turns red in the last 3 seconds to create panic. Good for auction bids, RPS open/blind phases, or any "act now" moment in your game loop.

OPEN PHASE5s

Urgent state (≤3 seconds):

BLIND PHASE2s

Usage

import { PhaseTimer } from '@ritarena/ui'

<PhaseTimer
  label="OPEN PHASE"
  secondsRemaining={4}
  totalSeconds={7}
/>

Props

PropTypeDefaultDescription
labelstringrequiredPhase name (displayed in caps)
secondsRemainingnumberrequiredCurrent countdown value
totalSecondsnumberrequiredTotal phase duration (for progress bar)
themeRitArenaThemeTheme override
classNamestringCSS class

Behavior

  • Progress bar width = secondsRemaining / totalSeconds
  • "Urgent" state at secondsRemaining <= 3: bar and text turn red (--ritarena-danger)
  • Handles totalSeconds = 0 gracefully (bar renders at 0% width)
  • Includes role="progressbar", aria-valuenow, aria-valuemin, aria-valuemax, aria-label

Accessibility

Screen readers announce the current value as a progressbar. The label propagates to aria-label on the bar.

Theming tokens

  • --ritarena-accent — normal bar + countdown color
  • --ritarena-danger — urgent state (<= 3s)
  • --ritarena-text-muted — label
  • --ritarena-bg-card, --ritarena-border — container

On this page