Skip to content

Display

Badge

Count and status indicators anchored to icons and avatars, plus an inline tone pill with a status dot for text rows.

<script>
  import { Badge, IconButton } from "@codeatlasdev/ui";
</script>

<Badge count={3}><IconButton aria-label="Messages">…</IconButton></Badge>

Badge wraps its child and positions the indicator on the corner. Pass count for a number (hidden at 0, capped at 99+) or dot for a plain status dot. The indicator is a role="status" element labelled “New” (dot) or “N notifications” (count) from the i18n catalog; still give the wrapped control its own accessible name.

#113

Dot and counts

`dot` shows a plain indicator, `count` shows a number capped at `99+`.

3 99 99+

Reference #113 · Pick in the gallery

Code
svelte
<script lang="ts">
  import { Badge, IconButton, Flex } from '@codeatlasdev/ui';
  import { Bell, Mail, ShoppingCart } from '@lucide/svelte';
</script>

<Flex gap="4" align="center" wrap>
  <Badge dot><IconButton aria-label="Notifications"><Bell size={20} /></IconButton></Badge>
  <Badge count={3}><IconButton aria-label="Messages"><Mail size={20} /></IconButton></Badge>
  <Badge count={99}><IconButton aria-label="Cart"><ShoppingCart size={20} /></IconButton></Badge>
  <Badge count={100}><IconButton aria-label="Notifications"><Bell size={20} /></IconButton></Badge>
</Flex>
#114

On avatars

Status dots on avatars.

AL CM DK

Reference #114 · Pick in the gallery

Code
svelte
<script lang="ts">
  import { Badge, Avatar, Flex } from '@codeatlasdev/ui';
</script>

<Flex gap="4" align="center" wrap>
  <Badge dot color="success"><Avatar alt="Ana Lima" size="md" /></Badge>
  <Badge dot color="warning"><Avatar alt="Carlos M" size="md" /></Badge>
  <Badge dot color="error"><Avatar alt="Diana K" size="md" /></Badge>
</Flex>
#112

Colors

brand, success, warning and error.

5 5 5 5

Reference #112 · Pick in the gallery

Code
svelte
<script lang="ts">
  import { Badge, IconButton, Flex } from '@codeatlasdev/ui';
  import { Bell } from '@lucide/svelte';
</script>

<Flex gap="4" align="center" wrap>
  <Badge count={5} color="brand"><IconButton aria-label="Notifications"><Bell size={20} /></IconButton></Badge>
  <Badge count={5} color="success"><IconButton aria-label="Notifications"><Bell size={20} /></IconButton></Badge>
  <Badge count={5} color="warning"><IconButton aria-label="Notifications"><Bell size={20} /></IconButton></Badge>
  <Badge count={5} color="error"><IconButton aria-label="Notifications"><Bell size={20} /></IconButton></Badge>
</Flex>

Status pill in a text row: tone. <Badge tone="danger" subtle dot size="md">Overdue</Badge> renders an inline pill in text flow (its children are the label) instead of a corner indicator: 24px high at md (20px at sm), a 6px dot with dot, and with subtle a translucent tinted background whose label clears 4.5:1 in light and dark. Tones: brand, success, danger, warning, info, neutral. The dot is decorative: the label carries the meaning, so never rely on colour alone. Do not write a .overdue class with color-mix and a .dot span. For a status with a fixed vocabulary and no dot, StatusChip is still fine.

#900

Inline pill

`tone` + `subtle` + `dot` next to a title in a list row.

  • Call back Marina Costa Overdue
  • Send contract to Atlas Logistics Due today
  • Review quote #4821 Done
  • Intro email, Orion Tech Draft

Reference #900 · Pick in the gallery

Code
svelte
<script lang="ts">
  import { Badge } from '@codeatlasdev/ui';
</script>

<ul class="rows">
  <li><span class="title">Call back Marina Costa</span><Badge tone="danger" subtle dot size="md">Overdue</Badge></li>
  <li><span class="title">Send contract to Atlas Logistics</span><Badge tone="warning" subtle dot size="md">Due today</Badge></li>
  <li><span class="title">Review quote #4821</span><Badge tone="success" subtle dot size="md">Done</Badge></li>
  <li><span class="title">Intro email, Orion Tech</span><Badge tone="neutral" subtle size="md">Draft</Badge></li>
</ul>

<style>
  .rows { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--ca-space-2); }
  li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ca-space-2); }
  .title { color: var(--ca-text-primary); }
</style>

Props

PropTypeDefaultDescription
countnumberundefinedNumber to display. Hidden when 0 or undefined unless `dot` is set. Values above 99 render as `99+`.
dotbooleanfalseAnchored: shows a dot instead of a number. With `tone`: a 6px leading dot inside the pill.
color'brand' | 'success' | 'error' | 'warning''brand'Anchored indicator colour. Ignored when `tone` is set.
tone'brand' | 'success' | 'danger' | 'warning' | 'info' | 'neutral'undefinedRenders an inline pill (`ca-badge--inline`) in text flow; children are its label. `danger` is the error semantic.
subtlebooleanfalsePill only: translucent tinted background with a tone-coloured label (`ca-badge--subtle`) instead of a solid fill.
size'sm' | 'md''sm'Pill only: 20px (`sm`) or 24px (`md`) high.
classstring''Extra class names.
childrenSnippetundefinedThe element the badge is anchored to.