# Progress cards and steps for Ghost

HTML card + code injection · Works with any Ghost theme · No JavaScript

Source: https://brightthemes.com/snippets/progress-cards

Cards with a progress bar and a numbered step list, to show how far a course, a project or a how-to has come.

## When to use it
- A multi-part course or series, with the step list at the top of each part showing where it fits.
- A fundraising or member-goal update, showing how close you are each time you post one.
- A build log or project diary, to show which stage a long project has reached.
When not to: For a number that changes daily, such as a live member count, it falls behind: it only changes when you edit the post.

## The code

HTML:

```html
<div class="bt-progress-card" style="--bt-progress-value: 100%;">
  <div class="bt-progress-card-head">
    <span class="bt-progress-card-title">Information gathering</span>
    <span class="bt-progress-card-value">100% done</span>
  </div>
  <p class="bt-progress-card-text">Gather everything the project needs, and ask questions that get to the real business needs.</p>
  <div class="bt-progress-card-bar" aria-hidden="true"></div>
</div>

<div class="bt-progress-card" style="--bt-progress-value: 60%; --bt-progress-accent: #0f766e;">
  <div class="bt-progress-card-head">
    <span class="bt-progress-card-title">Planning and wireframes</span>
    <span class="bt-progress-card-value">60% done</span>
  </div>
  <p class="bt-progress-card-text">Turn what you learned into a site plan: a site map first, then wireframes for the key pages.</p>
  <div class="bt-progress-card-bar" aria-hidden="true"></div>
</div>

<div class="bt-progress-card" style="--bt-progress-value: 25%; --bt-progress-accent: #c2410c;">
  <div class="bt-progress-card-head">
    <span class="bt-progress-card-title">Design and build</span>
    <span class="bt-progress-card-value">25% done</span>
  </div>
  <p class="bt-progress-card-text">Apply the brand to the wireframes, then build the pages and test them on phones and desktops.</p>
  <div class="bt-progress-card-bar" aria-hidden="true"></div>
</div>

<ol class="bt-progress-steps" aria-label="Progress: step 3 of 5">
  <li data-status="complete">Problem</li>
  <li data-status="complete">Goal</li>
  <li aria-current="step">Users</li>
  <li>Success</li>
  <li>Budget</li>
</ol>
```

CSS:

```css
.bt-progress-card,
.bt-progress-steps {
  --bt-progress-accent: var(--ghost-accent-color, #4433ff);
  --bt-progress-track: color-mix(in srgb, currentColor 15%, transparent);
  --bt-progress-radius: 6px;
}

.bt-progress-card {
  --bt-progress-value: 0%;
  box-sizing: border-box;
  margin: 0 0 1.5em;
  overflow: hidden;
  border: 1px solid var(--bt-progress-track);
  border-radius: var(--bt-progress-radius);
  background-color: color-mix(in srgb, var(--bt-progress-accent) 5%, transparent);
}

.bt-progress-card-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25em 1em;
  padding: 1em 1em 0;
}

.bt-progress-card-title {
  font-weight: 600;
}

.bt-progress-card-value {
  font-size: 0.875em;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.bt-progress-card-text {
  margin: 0.25em 0 0;
  padding: 0 1.111em 1.111em; /* 1em of the card at this 0.9em size, so it lines up with the title */
  font-size: 0.9em;
  opacity: 0.85;
}

.bt-progress-card-bar {
  height: 6px;
  background: linear-gradient(var(--bt-progress-accent), var(--bt-progress-accent)) left / var(--bt-progress-value) 100% no-repeat, var(--bt-progress-track);
}

.bt-progress-steps {
  --bt-progress-dot: 2em;
  display: flex;
  margin: 1.5em 0 2em;
  padding: 0;
  list-style: none;
  counter-reset: progress-step;
}

.bt-progress-steps > li {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  margin: 0;
  padding: 0 0.1em;
  text-align: center;
  font-size: 0.85em;
  overflow-wrap: break-word;
  counter-increment: progress-step;
}

.bt-progress-steps > li::before {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: var(--bt-progress-dot);
  height: var(--bt-progress-dot);
  margin: 0 auto 0.5em;
  border: 2px solid var(--bt-progress-track);
  border-radius: 50%;
  font-weight: 700;
  content: counter(progress-step);
}

.bt-progress-steps > li + li::after {
  position: absolute;
  top: calc(var(--bt-progress-dot) / 2 - 1px);
  right: calc(50% + var(--bt-progress-dot) / 2 + 0.25em);
  left: calc(-50% + var(--bt-progress-dot) / 2 + 0.25em);
  height: 2px;
  background-color: var(--bt-progress-track);
  content: '';
}

.bt-progress-steps > li[data-status='complete']::before {
  border-color: var(--bt-progress-accent);
  background-color: var(--bt-progress-accent);
  color: #fff;
  content: '✓';
  content: '✓' / 'Done: ';
}

.bt-progress-steps > li[aria-current='step'] {
  font-weight: 700;
}

.bt-progress-steps > li[aria-current='step']::before {
  border-color: var(--bt-progress-accent);
  border-width: 3px;
}

.bt-progress-steps > li[data-status='complete']::after,
.bt-progress-steps > li[aria-current='step']::after {
  background-color: var(--bt-progress-accent);
}
```

## Add it to your site

1. Copy the **CSS** and paste it in **Settings › Advanced › Code injection › Site header**, between `<style>` and `</style>`. Once per site.
2. In a post, add an **HTML card** (type `/html`) and paste the **HTML**.
3. Change the example text to your own, then publish or update the post.

Tip: save the card as a Ghost snippet to add it to any post from the card menu: how Ghost snippets work, https://brightthemes.com/blog/ghost-snippets

## How it works

The snippet has two parts you can use on their own.

A **progress card** is a title, a short text and a bar. Set how full the bar is with `--bt-progress-value` in the card's `style` attribute, and write the same number in the card ("60% done"). That text is what screen readers read, so the bar itself is hidden from them. Give a card its own color with `--bt-progress-accent`.

The **step list** is a numbered list, `<ol class="bt-progress-steps">`, which the CSS draws as circles joined by a line. Mark the steps you've finished with `data-status="complete"` (a filled circle with a check) and the step you're on with `aria-current="step"` (a thicker ring and a bold label), which screen readers announce as the current step. Update the list's `aria-label` ("step 3 of 5") when you move on. Add or remove `<li>` items for more or fewer steps; keep the labels to a word or two, since all the steps share the width on a phone.

Both parts use your accent color and a tint of the text color, so they work in light and dark themes. They are static: to show new progress, edit the post. The CSS from code injection doesn't reach emails, so in a newsletter they show as plain text and a numbered list.

## Customize
| Variable | Default | What it changes |
|---|---|---|
| `--bt-progress-accent` | `var(--ghost-accent-color, #4433ff)` | The color of the bar, the card tint and the done and current steps. Defaults to your site's accent color; set it on one card or step list to change only that one. |
| `--bt-progress-value` | `0%` | How full a card's bar is, from 0% to 100%. Set it on each card, and update the percentage text to match. |
| `--bt-progress-track` | `15% of the text color` | The card border, the empty part of the bar, and the rings and lines of steps to come. |
| `--bt-progress-radius` | `6px` | The cards' corner radius. |
| `--bt-progress-dot` | `2em` | The size of the step circles. |

It works with every Ghost theme, including ours (https://brightthemes.com/themes). Something not right? Ask support: https://brightthemes.com/support
