Skip to content

StatusDot

An 8px dot showing a state, gray when there is none. It is a role="img" named by label, and working replaces the dot with an animated glyph in the state’s color.

<StatusDot state="success" label="Online" />
<StatusDot variant="hollow" label="Not started" />
<StatusDot state="danger" variant="hollow" working label="Reconnecting" />
<StatusDot
  state="success"
  variant="solid"
  working={false}
  label="Online"
/>
  • state picks the color: info, warning, success, danger, or disabled. Leave it out for the gray dot.
  • variant="hollow" draws a ring in the state’s color with no fill. <StatusDot variant="hollow" label="Not started" /> is the gray ring.
  • working replaces the dot with an animated glyph in the state’s color on the same 8px box, so a change never shifts the layout.
  • label is the accessible name, so always give one. A sighted viewer sees only the color, so pair the dot with visible text or a tooltip that shows the label.

Solid

no state

info

warning

success

danger

disabled

Hollow

no state

info

warning

success

danger

disabled

Working

no state

info

warning

success

danger

disabled

A dot is not focusable by itself. Give it tabindex="0" inside Tooltip.Trigger so keyboard users reach the tooltip, and keep the label as its aria-label.

Code
InTooltip.svelte
<script lang="ts">
import { StatusDot, Tooltip } from "@viamrobotics/prime-ui";
</script>
<div class="not-content">
<Tooltip>
<Tooltip.Trigger class="inline-flex">
<StatusDot state="success" label="Online" tabindex={0} class="focus-ring" />
</Tooltip.Trigger>
<Tooltip.Content placement="right">Connected 2 minutes ago</Tooltip.Content>
</Tooltip>
</div>

class lands on the dot, which wears the status-dot component class and one status-dot-<state> modifier. See Component classes for the plain HTML form.

The dot is not interactive, so it takes no keys. With tabindex="0" it becomes a tab stop, which opens a tooltip around it.

PropTypeDefaultDescription
stateStatusDotStateWhich state to show. Leave it out for the gray dot.
variantStatusDotVariant'solid'hollow draws a ring in the state's color with no fill.
workingbooleanfalseReplaces the dot with an animated glyph in the state's color, on the same 8px box.
labelstringThe accessible name. A dot has no text of its own, so this is required.

Plus everything in HTMLAttributes<HTMLSpanElement>, spread onto the element.