DEV3 Technologies home

Status components with uptime bars

A status page component list with a state badge and a 45-day bar strip per service, coloured by daily availability.

Tailwind CSSDashboard widgetsstatus-pageuptimebarsmonitoring

Live preview

Code

<section class="mx-auto max-w-2xl px-4" aria-labelledby="status-title">
  <h2 id="status-title" class="mb-4 text-lg font-semibold text-slate-900">System status</h2>
  <ul id="components" class="divide-y divide-slate-200 rounded-xl border border-slate-200 bg-white"></ul>
</section>

How it works

What it solves

Status pages answer two questions: is everything working now, and has it been reliable lately. A badge answers the first, while a row of daily bars answers the second at a glance, the way users expect from a public status site.

How it works

Each component is an object with a current state, an overall uptime figure and an array of daily availability percentages. The script maps every day to a thin flex child; barColor picks green at 99% and above, amber from 90%, rose below that, and grey when the value is null for days without data. The bars sit in a flex-1 row with a one pixel gap, so any number of days fills the same width without a chart library.

The strip is given role="img" with a text summary, since forty-five coloured boxes would be noise for a screen reader. Each bar still carries a title tooltip for pointer users who hover for the exact day.

Adapting it

  • Load the array from your own endpoint or render the markup on the server instead of in the browser.
  • Adjust the colour thresholds to match the service level you promise.
  • Make the period 30 or 90 days just by changing the array length.

Pitfalls

  • Compute daily percentages from checks, not from an average of averages.
  • Escape component names if they are user supplied before using template strings with innerHTML.
  • Never use colour alone; keep the textual badge.

How to use it

  1. Add the section markup to your status page and load the script after it.
  2. Replace the sample components array with data from your monitoring storage.
  3. Keep the state keys in sync with the badge classes in the script, or add more.
  4. Escape any dynamic names before inserting them.

Licence: DEV3 Snippet Licence. Free to use, change and ship in personal and commercial projects. Attribution is appreciated, not required. Please do not redistribute snippets as a collection.

Related snippets