Bruno DelorenceBruno
Appearance
Appearance

Choose your reading theme.

Contact

Island actions

The black pill at the top of a phone, used by an assistant to report live actions: it buds off a drop, glows red, opens to a deal at risk and walks a follow-up through to done.

island-actions/island-actions.tsx
Live · interactive

The live component, numbered part by part. Every measurement is read from it as it is drawn. Point at a row to outline its part, or at a part to find its row.

The choices it offers, each value drawn live and the default marked, with how to pick one.

When to use

  • An assistant on a phone that works in the background and has to report a short task: needs you, working, ready for review, done.
  • A flow of two or three taps that should never leave the current screen: open, send, approve.
  • A live status that changes shape with its weight: a small pill while it works, a wide card when it needs a decision.
  • A brand moment for an agent’s actions on mobile, where the morphing black shape is the product’s signature.

When not to use

  • Anything to read at length or edit. Open a sheet or a full screen; the island holds one line and one action.
  • Several tasks at once. It shows one story at a time; use a notification list or an inbox.
  • Desktop or a wide layout. It is drawn as the top of a 390-point phone; use a toast or an approval card.
  • Errors that block the person. Use an alert dialog with a clear way out, not a pill that folds itself away.
  • Plain system notifications with no follow-up. Use a toast; the island’s steps exist for a decision.

The story

Each state hands on to the next by a tap, or by itself when the island runs itself (no state).

  • A tap on the plain pill raises the alert; a tap on the alert opens the deal at risk; a tap on the deal or the draft folds it back to the alert, and one on the summary folds it home.
  • Open drafts the follow-up, Send folds the island to the spinner, and Edit takes the draft back.
  • The spinner closes into a ring after about 1.5 s; a tap on it approves, and the approval opens the summary half a second later.
  • Show what was done lists the apps used, which stay until a tap on the island, on Dismiss or Escape folds them home.
  • Escape folds it home from any state.

Controlled or self-running

Without state the island keeps its own state from defaultState, moves on by itself from working, approved and all done, and reports each step to onStateChange. With state it shows that state and nothing more: taps only call onStateChange, nothing moves on by itself, and the demo stays off. Control it when the steps follow a real task, such as a reply that takes as long as it takes to write.

Each one drawn with the component itself, used well or badly.

The island holds one line at a time, read in passing over another screen: a name, what happened, and one step.

  • dealName is the short name of the thing at stake, a word or two: Halden, Northwind. It goes before “deal at risk!” on one line.
  • assistantName is a short name, a word: it is read out in every announcement and shown in “Tuli completed 4 actions”.
  • actionCount counts finished actions the reader can see on the next tap; “action” and “actions” follow it.
  • The rest of the wording is in the component: Follow up, Draft reply ready, All done!. Change it there, keep each line under the card’s width, and keep the announcements and button names in step.

You can add this component with the shadcn CLI or by hand:

Into components/island-actions of any React project, with no setup:

Terminal
npx shadcn@latest add https://brunodelorence.com/r/island-actions.json

Either way it needs React 19 and a bundler that supports CSS Modules, such as Next.js or Vite. It has a dark colour scheme: it follows your page’s color-scheme, light unless the page sets one, or its colorScheme prop, with nothing to configure. Browsers without light-dark() show it light.

Usage

assistant-island.tsx
import { IslandActions, type IslandState } from './island-actions';import { useState } from 'react';export function AssistantIsland() {  const [state, setState] = useState<IslandState>('alert');  return (    <IslandActions      state={state}      onStateChange={setState}      assistantName="Tuli"      dealName="Halden"      actionCount={4}    />  );}

Each state below is a live instance, locked so you can study it.

The pieces it is built from, each with its measurements read live.

A phone-top island for an assistant at work. The pill buds off a gooey drop that lights up as the assistant’s mark and is swallowed back into a red alert. Tap it: a deal is at risk; open it and a reply is drafted; send it and the island spins while it writes, glows blue for review, turns green once approved, reports four actions done, lists the apps it used and folds back into the plain pill. Every state is a prop, and every button works.

  • The phone is drawn in CSS at its design size, a 390 × 844 screen, and scaled as one piece from the stage’s own size (a size container; tan(atan2()) of two lengths is their ratio), so its top fills four fifths of the stage, close up on the island.
  • The black is two boxes, the pill and a drop, in one layer under an SVG filter: a Gaussian blur, then a colour matrix that turns alpha into a hard threshold. Near each other their blurred edges add up past the threshold, so they stretch a neck and melt together; apart they are two clean shapes. The mark, words and buttons sit above, outside the filter.
  • Every part is placed in design px from the island’s top middle, per state, and moves there by CSS transitions whose curve is a damped spring sampled into linear(): stiffness 380 and damping 22 for the pill (about 11% past, settled in 0.55 s), a softer 150 / 15 for the drop leaving and coming back.
  • Leaving the plain pill runs through two frames before the target: the drop leaves (1 s), the mark lights up in it (0.5 s), then it is swallowed. Coming home is the reverse: the mark pulls out to the left, goes dark, and the drop melts back in.
  • Words come in one by one, 70 ms apart, out of a 6 px blur, once the pill has made room; badges pop from 60% scale in order. The spinner’s arc grows from 6% to 86% of the ring as it turns, then closes into a ring and a tick is drawn in.
  • With `state`, the island shows that state and only reports taps through onStateChange. Without it, it runs itself (the reply is written in 1.7 s, an approval opens the report, "All done" folds away after a second), and while on screen and untouched a demo finger plays the whole story in a 14 s loop. Any input hands it to the reader.
PropTypeDefaultDescription
state'idle' | 'alert' | 'risk' | 'followUp' | 'working' | 'review' | 'done' | 'complete' | 'allDone'—Shows this state and leaves every change to you: taps only call onStateChange, nothing moves on by itself and the demo is off. Changing it animates there.
defaultStateIslandState'idle'Where an island that runs itself starts.
onStateChange(state: IslandState) => void—Called with the state a tap asks for, and, when the island runs itself, with each state it moves on to.
assistantNamestring'Tuli'The assistant’s name, in “Tuli completed 4 actions”.
dealNamestring'Halden'The deal’s name, in “Halden deal at risk!”.
actionCountnumber4How many actions the report counts, in its green badge and its words.
autoplaybooleantrueWhile visible and untouched, a demo finger plays the story in a 14 s loop (not with `state`). Any input from the reader stops it.
colorScheme'light' | 'dark' | 'system'—Its colours: light, dark, or the reader’s system setting. Without it the component follows the page’s color-scheme, which is light unless the page sets one.
classNamestring—Added to the stage element.

Focus through the story

When the control that has focus goes away with its state, focus moves to the new state’s first control, or to the island itself, so the keyboard never drops back to the page (WCAG 2.4.3, Focus order). Hidden controls are inert, and Escape folds the island home from anywhere.

Steps that move on by themselves

Running itself, the island leaves working after about 1.5 s and approved after half a second, as the assistant moves on; neither holds anything to read or act on that the next state doesn’t carry. All done stays until the reader closes it, so nothing they need goes away on a timer (WCAG 2.2.1, Timing adjustable); only the demo folds it home by itself. Each new state is announced in a polite live region (role="status", WCAG 4.1.3, Status messages). The demo stops for good at the reader’s first press or key (WCAG 2.2.2, Pause, Stop, Hide).

Target size

The controls are drawn at 30 to 46 design points, and each reaches 6 points past its edge for a finger. The phone scales with the stage, and on a small stage each control’s hit area, and the island’s own, grows past what is drawn so it never takes less than 24 × 24 px on the page (WCAG 2.5.8, Target size).

Contrast

The words on the island are white at 19:1 and the grey aside 8.3:1 on black, and the count is white on green at 4.8:1 (WCAG 1.4.3, AA). The island is black in both schemes, so these hold by day and at night. The red, blue and green marks reach at least 3:1 against what is behind them (WCAG 1.4.11, AA).

Colour isn’t the only signal

The red, blue and green rims mark attention, review and approval, and the island’s name and the announcement say the same in words: Reply ready for review, Reply approved (WCAG 1.4.1, Use of colour).

In this build

  • The island is a real button: its name says what the assistant is reporting, aria-expanded says whether it is open, and a press opens or closes it. Escape folds it back to the plain pill.
  • Every control on it (open the deal, send the follow-up, edit the draft, approve, show what was done, dismiss) is a button with its own name and a visible :focus-visible ring; hidden ones are inert, so neither the keyboard nor a screen reader reaches them.
  • A live region announces each new state: the alert, the deal at risk, the draft being written and ready, the approval and the report.
  • The phone, status bar, mark, badges, goo shapes and demo finger are decorative and hidden from assistive technology.
  • Under reduced motion the island changes state in one step, with no drop, blur, spring, pulse or spinning, and the demo never plays. The pulse and the spinner also pause while the island is off screen or the tab is hidden.

The complete source behind this demo. Open source under the MIT license, © 2026 Bruno Delorence: copy it, change it, ship it.

island-actions.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import {  useEffect,  useEffectEvent,  useId,  useLayoutEffect,  useRef,  useState,  type CSSProperties,  type ReactNode,} from 'react';import {  Bang,  CalendarMark,  ChatMark,  DealMark,  DotsMark,  MailMark,  OpenMark,  Pencil,  Tick,
icons.tsx
// Copyright (c) 2026 Bruno Delorence. MIT License./* * The island's small drawings, all decorative (the buttons around them carry the names). Each SVG * is sized by its class in the CSS, never by attributes, so the lab's 16 px rule for unsized SVGs * never reaches them. *//** The assistant's mark: three white dots of three sizes, on the red of the glyph behind them. */export function DotsMark({ className }: { className: string }) {  return (    <svg className={className} viewBox="0 0 30 22" aria-hidden="true" focusable="false">      <circle cx="7.2" cy="8.4" r="5.4" />      <circle cx="23.4" cy="7.6" r="4.4" />      <circle cx="15.6" cy="16.6" r="3.1" />    </svg>  );}/** An exclamation mark: a tapered bar and a dot. */export function Bang({ className }: { className: string }) {  return (    <svg className={className} viewBox="0 0 8 24" aria-hidden="true" focusable="false">      <path d="M1.4 2.6a2.6 2.6 0 0 1 5.2 0L5.6 15.2a1.6 1.6 0 0 1-3.2 0Z" />
use-autoplay.ts
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useRef, useState } from 'react';/* * When a demo may play on its own: while part of it is on screen and the tab is visible, never * under reduced motion, and never again once the reader has used it. `take()` hands it to the * reader for good (until the component remounts), so a demo the reader stopped never comes back * on its own (WCAG 2.2.2). `visible` alone says whether looping art (a pulse, a spinner) is worth * running at all. */export function useAutoplay<T extends HTMLElement>() {  const ref = useRef<T>(null);  const [visible, setVisible] = useState(false);  const [reduced, setReduced] = useState(true);  const [taken, setTaken] = useState(false);  useEffect(() => {    const element = ref.current;    if (!element) return;    let onScreen = false;    const update = () => setVisible(onScreen && !document.hidden);
island-actions.module.css
/* Island actions (island-actions.tsx): the top of a phone on a quiet grey stage, close up, with   the island at its top. The phone is drawn at its design size (a 390 × 844 screen) and scaled as   one piece from the stage's own size (a size container; tan(atan2()) of two lengths is their   ratio as a plain number), so its top fills about four fifths of the stage's width.   Colours are the tokens below, light-dark(light, dark) where the two differ: the component takes   the color-scheme it inherits from the page (light unless the page says otherwise), or the one   its colorScheme prop sets (data-color-scheme). The island and what is drawn on it are the same   on both: black hardware, lit by the assistant's red, blue and green.   Memory. The stage is one layout boundary sized from outside. The island's shapes are a handful   of small absolutely placed boxes inside it; the springs (linear() curves made in the TSX) move   them, and the words and badges come and go by opacity, blur and scale. */.root {  /* The stage, the phone's glass and its rim. */  --stage: #dbdbdb;  --glass-1: #eaeaea;  --glass-2: #e2e2e2;  --rim: rgb(255 255 255 / 0.95);  --shade: rgb(0 0 0 / 0.04);  /* The status bar's words and the home indicator. */  --status-ink: #0b0b0b;  /* The same on both schemes: the island and its lights. */