Skip to content
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
  • label names the promise, such as "First reply". due is the deadline as an ISO date and time.
  • window is the whole time in minutes (default 480). The bar shows the part that is left.
  • Under warn minutes (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".
  • now is 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 labels or a label pack: met, atRisk, and the functions left, over, and time.

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

NameTypeDefaultDescription
label*string—what the time limit is for, for example "First reply"
due*string—the deadline, as an ISO date and time
windownumber480the length of the whole window in minutes, for the bar
warnnumber60below this many minutes, the timer warns
nowstring—the time now, as an ISO date and time; without it, the clock of the reader after mount
metboolean—the work is done: the timer stops and says so
labelsPartial<{ left: (time: string) => string; over: (time: string) => string; met: string; atRisk: string; time: (h: number, m: number) => string; }>—

Released under the MIT License. Character names and artwork belong to their owners.