Status island
A dark pill that hangs from the top of the page and reshapes itself around what is happening: resting on a branch name, stretching out and filling up while a deploy runs, then settling on a green tick.
Ship it from anywhere
Press the island to deploy. It stays out of the way until there is something to say.
Options
Code
import { useLayoutEffect, useRef } from "react";
import "./status-island.css";
import "./spinner.css";
/* state is "rest", "busy" or "done". You decide when it changes; the island reshapes
itself to fit. time is how long it takes to fill, in milliseconds.
<StatusIsland state={state} onClick={deploy} rest="main" busy="Deploying to production" done="Live" /> */
export function StatusIsland({ state = "rest", rest, busy, done, time = 2600, ...props }) {
const island = useRef(null);
useLayoutEffect(() => {
const fit = () => {
const part = island.current.querySelector('[data-for="' + state + '"]');
island.current.style.setProperty("--dh-island-width", part.offsetWidth + "px");
};
fit();
document.fonts?.ready.then(fit);
}, [state, rest, busy, done]);
return (
<button className="dh-island" type="button" data-state={state} aria-live="polite" ref={island} style={{ "--dh-island-time": time + "ms" }} {...props}>
<span data-for="rest">{rest}</span>
<span data-for="busy">
<span className="dh-spinner" />
{busy}
</span>
<span data-for="done">
<i>
<svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true">
<path d="M3.500 8.500l3 3 6-7" />
</svg>
</i>
{done}
</span>
</button>
);
}/* The island shows one of three things, set by its data-state: "rest", "busy" or "done".
All three sit on top of each other; the script measures the one that is showing and
the pill stretches to fit it. */
.dh-island {
--dh-island-ease: cubic-bezier(0.23, 1, 0.32, 1);
position: relative;
display: grid;
justify-content: center;
height: 2.6em;
width: var(--dh-island-width, auto);
padding: 0;
overflow: hidden;
border: 0;
border-radius: 1.3em;
background: #0d0d0d;
box-shadow:
inset 0 0 0 0.5px rgb(255 255 255 / 0.14),
0 1px 2px rgb(0 0 0 / 0.3),
0 6px 8px -4px rgb(0 0 0 / 0.3);
color: #fff;
font: inherit;
font-size: 0.875em;
font-weight: 500;
letter-spacing: -0.01em;
white-space: nowrap;
cursor: pointer;
transition:
width 520ms cubic-bezier(0.3, 1.2, 0.4, 1),
transform 150ms var(--dh-island-ease);
}
.dh-island:active {
transform: scale(0.97);
}
.dh-island:focus-visible {
outline: 2px solid var(--dh-faint, #8a8a8a);
outline-offset: 2px;
}
.dh-island > span {
grid-area: 1 / 1;
position: relative;
display: inline-flex;
align-items: center;
justify-self: center;
gap: 0.6em;
padding: 0 1.05em 0 0.9em;
opacity: 0;
filter: blur(4px);
transform: scale(0.94);
transition:
opacity 240ms var(--dh-island-ease),
filter 240ms var(--dh-island-ease),
transform 240ms var(--dh-island-ease);
}
.dh-island[data-state="rest"] > [data-for="rest"],
.dh-island[data-state="busy"] > [data-for="busy"],
.dh-island[data-state="done"] > [data-for="done"] {
opacity: 1;
filter: none;
transform: none;
transition-duration: 380ms;
transition-delay: 140ms;
}
.dh-island small {
padding-left: 0.6em;
border-left: 0.5px solid rgb(255 255 255 / 0.22);
color: rgb(255 255 255 / 0.6);
font-size: 1em;
font-weight: 400;
}
.dh-island svg {
color: rgb(255 255 255 / 0.6);
}
.dh-island .dh-spinner {
color: #fff;
}
/* The tick, in a green disc that pops as it arrives. */
.dh-island i {
display: grid;
place-items: center;
width: 1.4em;
height: 1.4em;
margin-left: -0.2em;
border-radius: 50%;
background: #1fa750;
transform: scale(0.4);
transition: transform 520ms cubic-bezier(0.3, 1.5, 0.4, 1) 200ms;
}
.dh-island i svg {
width: 0.85em;
height: 0.85em;
color: #fff;
}
.dh-island[data-state="done"] i {
transform: none;
}
/* Progress: a lighter shade filling the pill from the left while it is busy. */
.dh-island::before {
content: "";
position: absolute;
inset: 0;
background: rgb(255 255 255 / 0.16);
opacity: 0;
transform: scaleX(0);
transform-origin: 0 50%;
transition: opacity 400ms var(--dh-island-ease), transform 0s 400ms;
}
.dh-island[data-state="busy"]::before {
opacity: 1;
transform: none;
transition: transform var(--dh-island-time, 2600ms) cubic-bezier(0.3, 0, 0.3, 1) 200ms;
}
@media (prefers-reduced-motion: reduce) {
.dh-island,
.dh-island > span,
.dh-island i {
filter: none !important;
transform: none !important;
transition-duration: 150ms !important;
transition-delay: 0s !important;
}
}
/* The preview: a page whose top edge is your colour breaking into dots, with the island
hanging from it. */
.dh-island-scene {
position: relative;
display: grid;
grid-template-rows: auto 1fr;
justify-items: center;
min-height: 450px;
padding-top: 14px;
background: var(--dh-bg, #f7f7f6);
color: var(--dh-fg, #171717);
font-size: 15px;
line-height: 1.5;
}
.dh-island-scene::before {
content: "";
position: absolute;
inset: 0 0 auto;
height: 190px;
background: var(--dh-accent, #2563ff);
-webkit-mask-image: linear-gradient(#000 22%, transparent 52%), radial-gradient(circle, #000 1.5px, transparent 1.9px);
mask-image: linear-gradient(#000 22%, transparent 52%), radial-gradient(circle, #000 1.5px, transparent 1.9px);
-webkit-mask-size: auto, 6px 6px;
mask-size: auto, 6px 6px;
-webkit-mask-position: 0 0, 50% 0;
mask-position: 0 0, 50% 0;
}
.dh-island-scene::after {
content: "";
position: absolute;
inset: 0 0 auto;
height: 190px;
background: linear-gradient(transparent 45%, var(--dh-bg, #f7f7f6));
}
.dh-island-scene .dh-island {
z-index: 1;
}
.dh-island-page {
z-index: 1;
align-self: center;
max-width: 24em;
padding: 0 24px 24px;
text-align: center;
}
.dh-island-page h2 {
margin: 0;
font-size: 1.6em;
font-weight: 500;
letter-spacing: -0.03em;
}
.dh-island-page p {
margin: 0.5em 0 0;
color: var(--dh-muted, #5c5c5c);
text-wrap: balance;
}.dh-spinner-row {
display: flex;
align-items: center;
gap: 1.5em;
}
.dh-spinner {
display: inline-block;
width: 1em;
height: 1em;
border: 0.11em solid color-mix(in srgb, currentColor 18%, transparent);
border-top-color: currentColor;
border-radius: 50%;
color: var(--dh-accent, var(--dh-fg, #171717));
animation: dh-spinner-turn 700ms linear infinite;
}
@keyframes dh-spinner-turn {
to {
rotate: 360deg;
}
}
.dh-spinner-button {
display: inline-flex;
align-items: center;
gap: 0.55em;
height: 2.6em;
padding: 0 1.15em;
border: 0;
border-radius: 0.65em;
background: var(--dh-accent, var(--dh-fg, #171717));
color: var(--dh-on-accent, var(--dh-bg, #fff));
font-family: inherit;
font-size: 1em;
font-weight: 500;
letter-spacing: -0.01em;
}
.dh-spinner-button .dh-spinner {
width: 0.9em;
height: 0.9em;
color: inherit;
}
@media (prefers-reduced-motion: reduce) {
.dh-spinner {
animation-duration: 2.4s;
}
}<div class="dh-island-scene">
<button class="dh-island" type="button" data-state="rest" aria-live="polite">
<span data-for="rest"><svg viewBox="0 0 16 16" width="13" height="13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="4.500" cy="3.500" r="1.750" /><circle cx="4.500" cy="12.500" r="1.750" /><circle cx="11.500" cy="5.500" r="1.750" /><path d="M4.500 5.250v5.500M11.500 7.250c0 2.500-3 2.500-5.500 3.500" /></svg>main<small>Deploy</small></span>
<span data-for="busy"><span class="dh-spinner"></span>Deploying to production</span>
<span data-for="done"><i><svg viewBox="0 0 16 16" width="14" height="14" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3.500 8.500l3 3 6-7" /></svg></i>Live<small>in 38s</small></span>
</button>
<div class="dh-island-page">
<h2>Ship it from anywhere</h2>
<p>Press the island to deploy. It stays out of the way until there is something to say.</p>
</div>
</div>/* The island shows one of three things, set by its data-state: "rest", "busy" or "done".
All three sit on top of each other; the script measures the one that is showing and
the pill stretches to fit it. */
.dh-island {
--dh-island-ease: cubic-bezier(0.23, 1, 0.32, 1);
position: relative;
display: grid;
justify-content: center;
height: 2.6em;
width: var(--dh-island-width, auto);
padding: 0;
overflow: hidden;
border: 0;
border-radius: 1.3em;
background: #0d0d0d;
box-shadow:
inset 0 0 0 0.5px rgb(255 255 255 / 0.14),
0 1px 2px rgb(0 0 0 / 0.3),
0 6px 8px -4px rgb(0 0 0 / 0.3);
color: #fff;
font: inherit;
font-size: 0.875em;
font-weight: 500;
letter-spacing: -0.01em;
white-space: nowrap;
cursor: pointer;
transition:
width 520ms cubic-bezier(0.3, 1.2, 0.4, 1),
transform 150ms var(--dh-island-ease);
}
.dh-island:active {
transform: scale(0.97);
}
.dh-island:focus-visible {
outline: 2px solid var(--dh-faint, #8a8a8a);
outline-offset: 2px;
}
.dh-island > span {
grid-area: 1 / 1;
position: relative;
display: inline-flex;
align-items: center;
justify-self: center;
gap: 0.6em;
padding: 0 1.05em 0 0.9em;
opacity: 0;
filter: blur(4px);
transform: scale(0.94);
transition:
opacity 240ms var(--dh-island-ease),
filter 240ms var(--dh-island-ease),
transform 240ms var(--dh-island-ease);
}
.dh-island[data-state="rest"] > [data-for="rest"],
.dh-island[data-state="busy"] > [data-for="busy"],
.dh-island[data-state="done"] > [data-for="done"] {
opacity: 1;
filter: none;
transform: none;
transition-duration: 380ms;
transition-delay: 140ms;
}
.dh-island small {
padding-left: 0.6em;
border-left: 0.5px solid rgb(255 255 255 / 0.22);
color: rgb(255 255 255 / 0.6);
font-size: 1em;
font-weight: 400;
}
.dh-island svg {
color: rgb(255 255 255 / 0.6);
}
.dh-island .dh-spinner {
color: #fff;
}
/* The tick, in a green disc that pops as it arrives. */
.dh-island i {
display: grid;
place-items: center;
width: 1.4em;
height: 1.4em;
margin-left: -0.2em;
border-radius: 50%;
background: #1fa750;
transform: scale(0.4);
transition: transform 520ms cubic-bezier(0.3, 1.5, 0.4, 1) 200ms;
}
.dh-island i svg {
width: 0.85em;
height: 0.85em;
color: #fff;
}
.dh-island[data-state="done"] i {
transform: none;
}
/* Progress: a lighter shade filling the pill from the left while it is busy. */
.dh-island::before {
content: "";
position: absolute;
inset: 0;
background: rgb(255 255 255 / 0.16);
opacity: 0;
transform: scaleX(0);
transform-origin: 0 50%;
transition: opacity 400ms var(--dh-island-ease), transform 0s 400ms;
}
.dh-island[data-state="busy"]::before {
opacity: 1;
transform: none;
transition: transform var(--dh-island-time, 2600ms) cubic-bezier(0.3, 0, 0.3, 1) 200ms;
}
@media (prefers-reduced-motion: reduce) {
.dh-island,
.dh-island > span,
.dh-island i {
filter: none !important;
transform: none !important;
transition-duration: 150ms !important;
transition-delay: 0s !important;
}
}
/* The preview: a page whose top edge is your colour breaking into dots, with the island
hanging from it. */
.dh-island-scene {
position: relative;
display: grid;
grid-template-rows: auto 1fr;
justify-items: center;
min-height: 450px;
padding-top: 14px;
background: var(--dh-bg, #f7f7f6);
color: var(--dh-fg, #171717);
font-size: 15px;
line-height: 1.5;
}
.dh-island-scene::before {
content: "";
position: absolute;
inset: 0 0 auto;
height: 190px;
background: var(--dh-accent, #2563ff);
-webkit-mask-image: linear-gradient(#000 22%, transparent 52%), radial-gradient(circle, #000 1.5px, transparent 1.9px);
mask-image: linear-gradient(#000 22%, transparent 52%), radial-gradient(circle, #000 1.5px, transparent 1.9px);
-webkit-mask-size: auto, 6px 6px;
mask-size: auto, 6px 6px;
-webkit-mask-position: 0 0, 50% 0;
mask-position: 0 0, 50% 0;
}
.dh-island-scene::after {
content: "";
position: absolute;
inset: 0 0 auto;
height: 190px;
background: linear-gradient(transparent 45%, var(--dh-bg, #f7f7f6));
}
.dh-island-scene .dh-island {
z-index: 1;
}
.dh-island-page {
z-index: 1;
align-self: center;
max-width: 24em;
padding: 0 24px 24px;
text-align: center;
}
.dh-island-page h2 {
margin: 0;
font-size: 1.6em;
font-weight: 500;
letter-spacing: -0.03em;
}
.dh-island-page p {
margin: 0.5em 0 0;
color: var(--dh-muted, #5c5c5c);
text-wrap: balance;
}.dh-spinner-row {
display: flex;
align-items: center;
gap: 1.5em;
}
.dh-spinner {
display: inline-block;
width: 1em;
height: 1em;
border: 0.11em solid color-mix(in srgb, currentColor 18%, transparent);
border-top-color: currentColor;
border-radius: 50%;
color: var(--dh-accent, var(--dh-fg, #171717));
animation: dh-spinner-turn 700ms linear infinite;
}
@keyframes dh-spinner-turn {
to {
rotate: 360deg;
}
}
.dh-spinner-button {
display: inline-flex;
align-items: center;
gap: 0.55em;
height: 2.6em;
padding: 0 1.15em;
border: 0;
border-radius: 0.65em;
background: var(--dh-accent, var(--dh-fg, #171717));
color: var(--dh-on-accent, var(--dh-bg, #fff));
font-family: inherit;
font-size: 1em;
font-weight: 500;
letter-spacing: -0.01em;
}
.dh-spinner-button .dh-spinner {
width: 0.9em;
height: 0.9em;
color: inherit;
}
@media (prefers-reduced-motion: reduce) {
.dh-spinner {
animation-duration: 2.4s;
}
}document.querySelectorAll(".dh-island").forEach((island) => {
const time = 2600;
let waiting;
/* Stretches the pill to the width of whatever it is showing now. */
const show = (state) => {
island.dataset.state = state;
const part = island.querySelector('[data-for="' + state + '"]');
island.style.setProperty("--dh-island-width", part.offsetWidth + "px");
};
const run = () => {
clearTimeout(waiting);
show("busy");
waiting = setTimeout(() => {
show("done");
waiting = setTimeout(() => show("rest"), 2600);
}, time + 300);
};
island.style.setProperty("--dh-island-time", time + "ms");
show("rest");
document.fonts?.ready.then(() => show(island.dataset.state));
island.addEventListener("click", run);
/* The first time it is seen, it runs once by itself. */
new IntersectionObserver(([seen], watcher) => {
if (!seen.isIntersecting) return;
watcher.disconnect();
waiting = setTimeout(run, 900);
}, { threshold: 0.6 }).observe(island);
});Status island is not in the Figma file yet.
Use the React or HTML code for now.