meowerse_
docs menu

StatusLine

One line of state with a glyph and a word: [ ok ], [wait], [fail] or [info].

import { StatusLine } from "@meowerse/ui"; · source packages/ui/src/components/StatusLine.tsx

variants and states

ok: online

ok

working: connecting…

wait
fail, with an action

info: no public service to check

info

props

proptypedefaultrequired
stateStatusState the state to show; fail renders as an alert.—yes
childrenReactNode the status text.—yes
liveboolean announces the non-fail states as a polite live region too.falseno
actionReactNode an action shown after the text, e.g. a retry button.—no
classNamestring extra class names to append.—no

css custom properties

variabledarklight
--c-danger#ff6b63#b42318
--c-fg-muted#b3b3af#46464a
--c-info#7cc4ff#1d5fa8
--c-ok#3ddc84#11652f
--c-warn#ffb454#8a5200
--fs-30.875remsame
--leading-normal1.5same
--sp-28pxsame

Classes: .mw-status. Set any of these variables on an ancestor (or wrap a subtree in .mw-theme--dark / .mw-theme--light) to restyle just that part of a page.

usage

ok

tsx
import { StatusLine } from "@meowerse/ui";

<StatusLine state="ok">online</StatusLine>

html (needs @meowerse/ui/tokens.css)
<p class="mw-status mw-status--ok"><span class="mw-status__tag" aria-hidden="true">[ ok ]</span><span class="sr-only">ok: </span><span class="mw-status__text">online</span></p>

wait

tsx
import { StatusLine } from "@meowerse/ui";

<StatusLine state="wait" live>connecting…</StatusLine>

html (needs @meowerse/ui/tokens.css)
<p class="mw-status mw-status--wait" role="status"><span class="mw-status__tag" aria-hidden="true">[wait]</span><span class="sr-only">working: </span><span class="mw-status__text">connecting…</span></p>

fail, with an action

tsx
import { StatusLine } from "@meowerse/ui";

<StatusLine state="fail" action={<Button size="sm">retry</Button>}>offline — check your connection</StatusLine>

info

tsx
import { StatusLine } from "@meowerse/ui";

<StatusLine state="info">no public service to check</StatusLine>

html (needs @meowerse/ui/tokens.css)
<p class="mw-status mw-status--info"><span class="mw-status__tag" aria-hidden="true">[info]</span><span class="sr-only">info: </span><span class="mw-status__text">no public service to check</span></p>

accessibility

  • The bracketed tag is hidden from assistive tech and a word (ok, working, error, info) is read instead.
  • fail is an alert; with live, the other states are a polite status.
  • Colours come from the theme tokens, so every state passes AA in both themes.

do and don't

do

  • Say what is happening and what to do: "[fail] offline — retry".

don't

  • Don't use it for long text.
  • Don't use the terminal (ANSI) colours for it.