Skip to content
astrostyle v0.6.2

Feedback

Tags, callouts, progress, spinners, empty states and toasts tell people what is going on. Every state color comes with words, never alone.

Tag 01

Neutral Accent Ready Repairing Wounded In the net
Solid New Online Low fuel 3 Synced Factions
<span class="ap-c-tag ap-c-tag--success">Ready</span>
<span class="ap-c-tag ap-c-tag--danger ap-c-tag--solid" aria-label="3 unread messages">3</span>
<span class="ap-c-tag" style="--ap-tag-tone: var(--ap-palette-indigo)">Factions</span>

Tones: --accent, --success, --warning, --danger, --info; add --solid to fill. A count works as a badge: give it a name that says what is counted.

Tokens of tag: set them on the element, on a parent or in a modifier.
TokenDefault
--ap-tag-tonevar(--ap-text-muted)
--ap-tag-inkvar(--ap-bg)
--ap-tag-bgcolor-mix(in oklab, var(--_tone) 16%, transparent)
--ap-tag-fgvar(--ap-text)
--ap-tag-border-colorvar(--_tone)
--ap-tag-padding-blockvar(--ap-space-xxs)
--ap-tag-padding-inlinevar(--ap-space-sm)
--ap-tag-gapvar(--ap-space-xs)
--ap-tag-radiusvar(--ap-radius-pill)

Callout 02

<aside class="ap-c-callout ap-c-callout--warning" aria-labelledby="fuel">
  <h3 class="ap-c-callout__title" id="fuel">Low fuel</h3>
  <p>Two jumps left before the reserve.</p>
</aside>
Tokens of callout: set them on the element, on a parent or in a modifier.
TokenDefault
--ap-callout-tonetransparent
--ap-callout-bgvar(--ap-surface-1)
--ap-callout-fgvar(--ap-text)
--ap-callout-title-colorvar(--ap-text)
--ap-callout-bar-width0
--ap-callout-paddingvar(--ap-space-lg)
--ap-callout-gapvar(--ap-space-sm)
--ap-callout-radiusvar(--ap-radius-card)

Progress 03

40%
85%
70%
20%
<progress class="ap-c-progress" max="100" value="40">40%</progress>
<progress class="ap-c-progress" aria-label="Downloading charts"></progress>  <!-- indeterminate -->

A native <progress>: without a value it is indeterminate. For discrete levels use the segmented meter.

Tokens of progress: set them on the element, on a parent or in a modifier.
TokenDefault
--ap-progress-fillvar(--ap-accent)
--ap-progress-trackvar(--ap-surface-3)
--ap-progress-heightvar(--ap-space-sm)
--ap-progress-radiusvar(--ap-radius-pill)
--ap-progress-durationcalc(var(--ap-duration-slow) * 5)

Spinner 04

Plotting course…
<span class="ap-o-cluster ap-o-cluster--gap-sm" role="status">
  <span class="ap-c-spinner" aria-hidden="true"></span> Plotting course…
</span>

The ring is decorative: the text in the role="status" region says what is happening. Modifiers: --sm, --lg, --spectrum.

Tokens of spinner: set them on the element, on a parent or in a modifier.
TokenDefault
--ap-spinner-sizevar(--ap-size-icon)
--ap-spinner-thicknessvar(--ap-border-width-strong)
--ap-spinner-arcconic-gradient(var(--ap-accent) 0 25%, var(--ap-border-subtle) 0)
--ap-spinner-durationcalc(var(--ap-duration-slow) * 3)

Empty state 05

No transmissions

Nobody has hailed the ship in this cycle. Open a channel to call the nearest station.

<section class="ap-c-empty-state" aria-labelledby="inbox-empty">
  <svg class="ap-c-empty-state__icon" aria-hidden="true">…</svg>
  <h3 class="ap-c-empty-state__title" id="inbox-empty">No transmissions</h3>
  <p class="ap-c-empty-state__text">Nobody has hailed the ship in this cycle.</p>
</section>
Tokens of empty-state: set them on the element, on a parent or in a modifier.
TokenDefault
--ap-empty-state-gapvar(--ap-space-md)
--ap-empty-state-paddingvar(--ap-space-xl)
--ap-empty-state-border-colorvar(--ap-border)
--ap-empty-state-radiusvar(--ap-radius-card)
--ap-empty-state-bgtransparent
--ap-empty-state-icon-sizevar(--ap-size-control-lg)
--ap-empty-state-icon-colorvar(--ap-text-subtle)
--ap-empty-state-title-colorvar(--ap-text)
--ap-empty-state-text-colorvar(--ap-text-muted)
--ap-empty-state-text-max48ch

Toast 06

import { createToaster } from 'astrostyle/js/toast'

const toaster = createToaster()
toaster.show({ title: 'Docked', message: 'All systems are back online.', tone: 'success' })
toaster.show({ message: 'Cargo sold.', action: { label: 'Undo', onClick: undoSale } })
toaster.show({ title: 'Hull breach', message: 'Seal deck 3.', tone: 'danger', urgent: true, duration: 0 })

Toasts close after five seconds; hovering or focusing one stops the clock. Up to three are shown at once, the rest wait. urgent toasts use role="alert"; the others are read politely. Never put the only way to do something in a toast.

Tokens of toast: set them on the element, on a parent or in a modifier.
TokenDefault
--ap-toast-tonetransparent
--ap-toast-bgvar(--ap-surface-1)
--ap-toast-fgvar(--ap-text)
--ap-toast-border-colorvar(--ap-border)
--ap-toast-bar-width0
--ap-toast-radiusvar(--ap-radius-control)
--ap-toast-shadowvar(--ap-elevation-overlay)
--ap-toast-paddingvar(--ap-space-md)
--ap-toast-gapvar(--ap-space-sm)
--ap-toast-offsetvar(--ap-space-lg)
--ap-toast-width24rem
--ap-toast-durationvar(--ap-duration-base)