Skip to content

ComponentsIdentity & presence

SourceSource

Status Indicator

A presence dot anchored to an avatar, with online, idle, do-not-disturb, offline and streaming states.

Presence, encoded in shape as well as colour: idle is a crescent, do-not-disturb is a bar, offline is a hollow ring. That is deliberate — the states stay distinguishable in greyscale, in a screenshot, and to a reader who cannot tell green from red.

Root class newt-status
import { Avatar } from "@/registry/bases/newt/ui/avatar"
import {
  StatusDot,
  StatusIndicator,
} from "@/registry/bases/newt/ui/status-indicator"

export default function StatusIndicatorDemo() {
  return (
    <div className="flex items-center gap-6">
      <StatusIndicator>
        <Avatar>A</Avatar>
        <StatusDot status="online" label="Online" />
      </StatusIndicator>
      <StatusIndicator>
        <Avatar>B</Avatar>
        <StatusDot status="idle" label="Idle" />
      </StatusIndicator>
      <StatusIndicator>
        <Avatar>C</Avatar>
        <StatusDot status="dnd" label="Do not disturb" />
      </StatusIndicator>
      <StatusIndicator>
        <Avatar>D</Avatar>
        <StatusDot status="offline" label="Offline" />
      </StatusIndicator>
    </div>
  )
}
<script setup lang="ts">
import { Avatar } from "~~/registry/bases/newt/ui/avatar"
import {
  StatusDot,
  StatusIndicator,
} from "~~/registry/bases/newt/ui/status-indicator"
</script>

<template>
  <div class="flex items-center gap-6">
    <StatusIndicator>
      <Avatar>A</Avatar>
      <StatusDot status="online" label="Online" />
    </StatusIndicator>
    <StatusIndicator>
      <Avatar>B</Avatar>
      <StatusDot status="idle" label="Idle" />
    </StatusIndicator>
    <StatusIndicator>
      <Avatar>C</Avatar>
      <StatusDot status="dnd" label="Do not disturb" />
    </StatusIndicator>
    <StatusIndicator>
      <Avatar>D</Avatar>
      <StatusDot status="offline" label="Offline" />
    </StatusIndicator>
  </div>
</template>

Installation

npx newtui@latest add status-indicatornpx shadcn@latest add @newtui/status-indicatornpx shadcn-vue@latest add @newtui/status-indicatorpnpm dlx newtui@latest add status-indicatorpnpm dlx shadcn@latest add @newtui/status-indicatorpnpm dlx shadcn-vue@latest add @newtui/status-indicatoryarn dlx newtui@latest add status-indicatoryarn dlx shadcn@latest add @newtui/status-indicatoryarn dlx shadcn-vue@latest add @newtui/status-indicatorbunx newtui@latest add status-indicatorbunx shadcn@latest add @newtui/status-indicatorbunx shadcn-vue@latest add @newtui/status-indicatordeno run -A npm:newtui@latest add status-indicatordeno run -A npm:shadcn@latest add @newtui/status-indicatordeno run -A npm:shadcn-vue@latest add @newtui/status-indicatorvlx newtui@latest add status-indicatorvlx shadcn@latest add @newtui/status-indicatorvlx shadcn-vue@latest add @newtui/status-indicatorvp dlx newtui@latest add status-indicatorvp dlx shadcn@latest add @newtui/status-indicatorvp dlx shadcn-vue@latest add @newtui/status-indicatornubx newtui@latest add status-indicatornubx shadcn@latest add @newtui/status-indicatornubx shadcn-vue@latest add @newtui/status-indicatornlx newtui@latest add status-indicatornlx shadcn@latest add @newtui/status-indicatornlx shadcn-vue@latest add @newtui/status-indicatorupx newtui@latest add status-indicatorupx shadcn@latest add @newtui/status-indicatorupx shadcn-vue@latest add @newtui/status-indicator

The shadcn CLI needs the @newtui registry in your components.json. Set it up.

Install the dependencies

npm install class-variance-authoritypnpm add class-variance-authorityyarn add class-variance-authoritybun add class-variance-authoritydeno add npm:class-variance-authorityvlt install class-variance-authorityvp add class-variance-authoritynub add class-variance-authorityni class-variance-authorityupm add class-variance-authority

Add the components it builds on

Copy the source into your project

import { cva, type VariantProps } from "class-variance-authority"
import * as React from "react"

import { cn } from "@/lib/utils"

const PULSE_KEYFRAMES = `@keyframes newt-presence-pulse{0%{transform:scale(.7);opacity:.6}70%{transform:scale(1.6);opacity:0}100%{transform:scale(1.6);opacity:0}}`

/*
 * The box that anchors the dot to the avatar. It has no role: a member list
 * draws one per row, and a live region per row would announce every change.
 * The state is spoken by the `label` of the dot.
 */
const StatusIndicator = React.forwardRef<
  HTMLDivElement,
  React.ComponentProps<"div">
>(({ className, ...props }, ref) => (
  <div
    ref={ref}
    className={cn("relative inline-block", className)}
    {...props}
  />
))
StatusIndicator.displayName = "StatusIndicator"

/*
 * The ring cuts the dot out of the avatar. Set `--newt-status-ring` to the
 * colour of the surface behind the avatar when it is not the base surface.
 */
const statusDotVariants = cva(
  "absolute -bottom-0.5 -end-0.5 h-3.5 w-3.5 rounded-full border-[3px] border-[color:var(--newt-status-ring,var(--newt-bg-base))]",
  {
    variants: {
      status: {
        online:
          "bg-newt-online after:pointer-events-none after:absolute after:-inset-1 after:rounded-full after:border-[1.5px] after:border-newt-online after:opacity-0 after:content-[''] after:[animation:newt-presence-pulse_2.4s_ease-out_infinite] motion-reduce:after:[animation:none]",
        idle: "bg-[color:var(--newt-status-ring,var(--newt-bg-base))] after:absolute after:inset-0 after:rounded-full after:bg-newt-idle after:content-[''] after:[clip-path:circle(60%_at_35%_35%)]",
        dnd: "bg-[color:var(--newt-status-ring,var(--newt-bg-base))] after:absolute after:start-1/2 after:top-1/2 after:h-[22%] after:w-[65%] after:-translate-x-1/2 after:-translate-y-1/2 after:rounded-[1px] after:bg-newt-dnd after:content-['']",
        offline: "bg-newt-offline",
        streaming: "bg-newt-streaming",
      },
    },
    defaultVariants: {
      status: "offline",
    },
  }
)

export interface StatusDotProps
  extends React.ComponentProps<"div">, VariantProps<typeof statusDotVariants> {
  /**
   * The state in words, such as "Online". It is read by a screen reader and
   * not shown. Leave it out when the state is already written beside the dot.
   */
  label?: string
}

const StatusDot = React.forwardRef<HTMLDivElement, StatusDotProps>(
  ({ className, status, label, children, ...props }, ref) => (
    <>
      {status === "online" ? (
        <style dangerouslySetInnerHTML={{ __html: PULSE_KEYFRAMES }} />
      ) : null}
      <div
        ref={ref}
        data-status={status ?? "offline"}
        className={cn(statusDotVariants({ status }), className)}
        {...props}
      >
        {label === undefined ? null : <span className="sr-only">{label}</span>}
        {children}
      </div>
    </>
  )
)
StatusDot.displayName = "StatusDot"

export { StatusIndicator, StatusDot, statusDotVariants }
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

/*
 * The box that anchors the dot to the avatar. It has no role: a member list
 * draws one per row, and a live region per row would announce every change.
 * The state is spoken by the `label` of the dot.
 */
const props = defineProps<{
  class?: HTMLAttributes["class"]
}>()
</script>

<template>
  <div :class="cn('relative inline-block', props.class)">
    <slot />
  </div>
</template>
<script setup lang="ts">
import type { HTMLAttributes } from "vue"

import { cn } from "@/lib/utils"

import { statusDotVariants, type StatusDotVariants } from "."

const props = withDefaults(
  defineProps<{
    status?: StatusDotVariants["status"]
    /**
     * The state in words, such as "Online". It is read by a screen reader and
     * not shown. Leave it out when the state is already written beside the dot.
     */
    label?: string
    class?: HTMLAttributes["class"]
  }>(),
  { status: "offline" }
)
</script>

<template>
  <div
    :data-status="props.status"
    :class="cn(statusDotVariants({ status: props.status }), props.class)"
  >
    <span v-if="props.label !== undefined" class="sr-only">{{
      props.label
    }}</span>
    <slot />
  </div>
</template>

<style>
@keyframes newt-presence-pulse {
  0% {
    transform: scale(0.7);
    opacity: 0.6;
  }
  70% {
    transform: scale(1.6);
    opacity: 0;
  }
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
</style>
import { cva, type VariantProps } from "class-variance-authority"

export { default as StatusIndicator } from "./StatusIndicator.vue"
export { default as StatusDot } from "./StatusDot.vue"

/*
 * The ring cuts the dot out of the avatar. Set `--newt-status-ring` to the
 * colour of the surface behind the avatar when it is not the base surface.
 */
export const statusDotVariants = cva(
  "absolute -bottom-0.5 -end-0.5 h-3.5 w-3.5 rounded-full border-[3px] border-[color:var(--newt-status-ring,var(--newt-bg-base))]",
  {
    variants: {
      status: {
        online:
          "bg-newt-online after:pointer-events-none after:absolute after:-inset-1 after:rounded-full after:border-[1.5px] after:border-newt-online after:opacity-0 after:content-[''] after:[animation:newt-presence-pulse_2.4s_ease-out_infinite] motion-reduce:after:[animation:none]",
        idle: "bg-[color:var(--newt-status-ring,var(--newt-bg-base))] after:absolute after:inset-0 after:rounded-full after:bg-newt-idle after:content-[''] after:[clip-path:circle(60%_at_35%_35%)]",
        dnd: "bg-[color:var(--newt-status-ring,var(--newt-bg-base))] after:absolute after:start-1/2 after:top-1/2 after:h-[22%] after:w-[65%] after:-translate-x-1/2 after:-translate-y-1/2 after:rounded-[1px] after:bg-newt-dnd after:content-['']",
        offline: "bg-newt-offline",
        streaming: "bg-newt-streaming",
      },
    },
    defaultVariants: {
      status: "offline",
    },
  }
)

export type StatusDotVariants = VariantProps<typeof statusDotVariants>

Update the import paths

The files import @/lib/utils and sibling components through the aliases in your components.json. Point them at wherever those live in your project.

No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds Status Indicator to your React project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.

No CLI, no components.json: paste this into Claude, Cursor, Copilot or any coding assistant and it adds Status Indicator to your Vue project by hand. The prompt carries the source of every file the CLI would write — this component's and those of the components it builds on — with the imports already pointed at the default aliases.

Usage

import { StatusIndicator } from "@/components/ui/status-indicator"

export function Example() {
  return <StatusIndicator />
}
<script setup lang="ts">
import { StatusIndicator, StatusDot } from "@/components/ui/status-indicator"
</script>

<template>
  <StatusIndicator />
</template>

Examples

Streaming

The streaming status marks a member who is live. Give the dot a label, because the dot alone says nothing to a screen reader.

Root class newt-status
import { Avatar } from "@/registry/bases/newt/ui/avatar"
import {
  StatusDot,
  StatusIndicator,
} from "@/registry/bases/newt/ui/status-indicator"

/* The fifth state: a member who is live, which outranks plain "online". */
export default function StatusIndicatorStreamingDemo() {
  return (
    <div className="flex items-center gap-3">
      <StatusIndicator>
        <Avatar>R</Avatar>
        <StatusDot status="streaming" label="Streaming" />
      </StatusIndicator>
      <div className="flex flex-col text-start">
        <span className="text-sm font-semibold text-newt-text-primary">
          rowan
        </span>
        <span className="text-xs text-newt-text-muted">
          Live · Speedrun practice
        </span>
      </div>
    </div>
  )
}
<script setup lang="ts">
import { Avatar } from "~~/registry/bases/newt/ui/avatar"
import {
  StatusDot,
  StatusIndicator,
} from "~~/registry/bases/newt/ui/status-indicator"

/* The fifth state: a member who is live, which outranks plain "online". */
</script>

<template>
  <div class="flex items-center gap-3">
    <StatusIndicator>
      <Avatar>R</Avatar>
      <StatusDot status="streaming" label="Streaming" />
    </StatusIndicator>
    <div class="flex flex-col text-start">
      <span class="text-sm font-semibold text-newt-text-primary">rowan</span>
      <span class="text-xs text-newt-text-muted">
        Live · Speedrun practice
      </span>
    </div>
  </div>
</template>

Member list

In a member list, pair each dot with the status in words so the state does not depend on colour or shape alone. The state is then written beside the dot, so the dot takes no label.

Root class newt-status
import { Avatar } from "@/registry/bases/newt/ui/avatar"
import {
  StatusDot,
  StatusIndicator,
} from "@/registry/bases/newt/ui/status-indicator"

const MEMBERS = [
  { name: "juniper", status: "online", label: "Online" },
  { name: "sorrel", status: "idle", label: "Idle" },
  { name: "thistle", status: "dnd", label: "Do not disturb" },
  { name: "bracken", status: "offline", label: "Offline" },
] as const

/* A member list: the dot carries the state, the label says it in words. */
export default function StatusIndicatorMembersDemo() {
  return (
    <ul className="m-0 flex w-full max-w-[240px] list-none flex-col gap-1 p-0">
      {MEMBERS.map((member) => (
        <li
          key={member.name}
          className="flex items-center gap-3 rounded-md px-2 py-1.5"
        >
          <StatusIndicator>
            <Avatar>{member.name.charAt(0).toUpperCase()}</Avatar>
            <StatusDot status={member.status} />
          </StatusIndicator>
          <div className="flex min-w-0 flex-col text-start">
            <span className="truncate text-sm font-semibold text-newt-text-primary">
              {member.name}
            </span>
            <span className="text-xs text-newt-text-muted">{member.label}</span>
          </div>
        </li>
      ))}
    </ul>
  )
}
<script setup lang="ts">
import { Avatar } from "~~/registry/bases/newt/ui/avatar"
import {
  StatusDot,
  StatusIndicator,
} from "~~/registry/bases/newt/ui/status-indicator"

/* A member list: the dot carries the state, the label says it in words. */
const members = [
  { name: "juniper", status: "online", label: "Online" },
  { name: "sorrel", status: "idle", label: "Idle" },
  { name: "thistle", status: "dnd", label: "Do not disturb" },
  { name: "bracken", status: "offline", label: "Offline" },
] as const
</script>

<template>
  <ul class="m-0 flex w-full max-w-[240px] list-none flex-col gap-1 p-0">
    <li
      v-for="member in members"
      :key="member.name"
      class="flex items-center gap-3 rounded-md px-2 py-1.5"
    >
      <StatusIndicator>
        <Avatar>{{ member.name.charAt(0).toUpperCase() }}</Avatar>
        <StatusDot :status="member.status" />
      </StatusIndicator>
      <div class="flex min-w-0 flex-col text-start">
        <span class="truncate text-sm font-semibold text-newt-text-primary">
          {{ member.name }}
        </span>
        <span class="text-xs text-newt-text-muted">{{ member.label }}</span>
      </div>
    </li>
  </ul>
</template>

Surfaces

The ring around the dot cuts it out of the avatar. It takes the colour of --newt-status-ring, and --newt-bg-base when that is not set. If the avatar sits on another surface, set --newt-status-ring to that surface on a wrapper, for example [--newt-status-ring:var(--newt-bg-surface)]. The idle crescent and the do-not-disturb bar read the same property.

API reference

StatusDot

PropType
status?"online" | "idle" | "dnd" | "offline" | "streaming"

The presence state.

Type"online" | "idle" | "dnd" | "offline" | "streaming"
Default"offline"
label?string

The state in words, such as "Online". A screen reader reads it; it is not shown. Leave it out when the state is written beside the dot.

Typestring

StatusIndicator takes no props of its own. It is the box that anchors the dot to the avatar. Every part also accepts the native attributes of the element it renders, and a className that is merged rather than replaced.

In the plain HTML and CSS distribution, put the state in a newt-status__label span inside the dot.

Accessibility

The dot has no role. A member list draws one dot per row, and a live region per row would announce every change of presence. The label of the dot names the state, so the state never depends on colour alone. If the state is already written beside the avatar, leave label out so it is not read twice.

The online state has a soft pulse, which is the one animation in the library. It is behind prefers-reduced-motion, and the state is legible without it.

Tokens

Status Indicator reads its colours, radii and motion from the --newt-* tokens installed with the library. Override a token and every component that reads it follows, including this one — see the token layer. In the plain HTML and CSS distribution the same component is newt-status.

  • --newt-bg-base
  • --newt-offline
  • --newt-online
  • --newt-idle
  • --newt-dnd
  • --newt-streaming