Calm motion: animations on this site only fade, with no movement
SLA timer
The time left to answer or to solve a ticket, with a warning and a breach state
An SLA (service level agreement) is a promise about time, such as "we reply within 4 hours". The timer shows how much of that time is left. Put it next to a ticket view.
Basic
First reply Met
Next reply 45 min left · At risk
Solve by 5 h 15 min left
Callback Overdue by 35 min
labelnames the promise, such as "First reply".dueis the deadline as an ISO date and time.windowis the whole time in minutes (default 480). The bar shows the part that is left.- Under
warnminutes (default 60), the timer says "At risk" and the bar is striped. After the deadline, it says "Overdue by …" in red. - If the work is done in time, set
met. The timer stops and shows "Met". nowis the time now, as an ISO date and time. Without it, the timer uses the clock of the reader after the page loads, and it updates each half minute.- Each state has a mark and words, so it does not rest on the color.
- Change the words with
labelsor a label pack:met,atRisk, and the functionsleft,over, andtime.
The minutesLeft function gives the minutes to a deadline. It is exported for your own views.
Usage
ts
import { BlessSlaTimer } from "blessing-ui";API
Props
| Name | Type | Default | Description |
|---|---|---|---|
label* | string | — | what the time limit is for, for example "First reply" |
due* | string | — | the deadline, as an ISO date and time |
window | number | 480 | the length of the whole window in minutes, for the bar |
warn | number | 60 | below this many minutes, the timer warns |
now | string | — | the time now, as an ISO date and time; without it, the clock of the reader after mount |
met | boolean | — | the work is done: the timer stops and says so |
labels | Partial<{ left: (time: string) => string; over: (time: string) => string; met: string; atRisk: string; time: (h: number, m: number) => string; }> | — |