> For the complete documentation index, see [llms.txt](https://jiffyjrdevelopment.gitbook.io/jiffyjrdevelopmentdocs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://jiffyjrdevelopment.gitbook.io/jiffyjrdevelopmentdocs/jiffy-jr-development-docs/jiffy-ui/api/countdown.md).

# Countdown

A persistent on-screen countdown timer. Pulses red when it enters the urgent range and fires a callback when it hits zero.

## Start

```lua
exports['jiffy-ui']:StartCountdown({
    label    = 'Event Starts In',
    duration = 60000,   -- total countdown in ms
    urgent   = 10000,   -- ms before zero when the timer turns red and pulses
}, function()
    -- fires when the timer reaches zero
    print('Countdown finished!')
end)
```

## Stop

```lua
exports['jiffy-ui']:StopCountdown()
```

## Server relay

```lua
exports['jiffy-ui']:StartCountdown(source, data)   -- callback not supported from server
exports['jiffy-ui']:StopCountdown(source)
```

{% hint style="info" %}
Only one countdown can be active at a time. Starting a new one while another is running replaces it.
{% endhint %}
