# FillWord (/docs/charts/fill-word)

FillWord makes the label the bar, so a named task shows its own progress: the word `uploading` renders with 62% of its
glyph ink in accent and the rest muted. A muted word is overlaid with an accent copy of itself, clipped to the value
fraction of the word's own inked extent, so 50% bisects the word. The fill is a percentage of the glyphs you see rather
than of a hidden wider track. Glyph ink is uneven, so fine reads are ±5%: the fill edge lands between letters, not on an
exact tick. Add `label="value"` for the percent alongside, or use Progress when precision is the point.

```tsx
<FillWord word="uploading" value={0.62} title="Upload" fontSize={18} />
```

## Install

```tsx
import { FillWord } from "@microcharts/react/fill-word";

<FillWord word="uploading" value={0.62} />
```

Setup (package + stylesheet): [Quickstart](/docs/quickstart#set-up-with-an-ai-agent) or paste [`/agent-setup.md`](/agent-setup.md) into your agent.

## Try it

```tsx
import { FillWord } from "@microcharts/react/fill-word/interactive";

<FillWord
  word="uploading"
  value={0.62}
/>
```

## When to use it

Use it for a labeled progress read in a sentence or cell, a sync or upload status where the label names the task, or a
quota or TTL where the word is the metric. For precise percentages use Progress, for trends Sparkline, and for many
parallel bars MiniBar.

## Sizing

**drain mode for a remaining-time story**

```tsx
<FillWord word="expiring" value={0.7} mode="drain" />
```

**show the exact percent alongside**

```tsx
<FillWord word="storage" value={0.4} label="value" />
```

## Variants

```tsx
<FillWord word="expiring" value={0.7} mode="drain" />
<FillWord word="storage" value={0.4} label="value" />
```

Fill is the default mode, since a word filling as a step completes covers most uses. `mode="drain"` empties the ink from
the left as the value rises, which is the remaining-time read fill can't give you: TTLs, expiring sessions.

## Edge cases

```tsx
<FillWord word="uploading" value={0} />
<FillWord word="uploading" value={1} />
```

At 0% the word is entirely the muted track; at 100% it is entirely accent ink. Both ends are limits of the same clip
rather than special cases in the code.

```tsx
<FillWord word="" value={0.5} />
```

An empty `word` renders nothing and reports **"No data."**, since there is no label to be the bar.

## Four homes

**In a sentence**

```tsx
<p>
  Upload progress{" "}
  <span className="mc-inline">
    <FillWord word="loading" value={0.62} summary={false} />
  </span>{" "}
  — 62% of the file transferred.
</p>
```

**In a table cell**

```tsx
<td>
  <FillWord word="loading" value={0.62} />
</td>
```

**In a KPI card**

```tsx
<div className="kpi">
  <span className="figure">62%</span>
  <span className="unit">complete</span>
  <FillWord word="loading" value={0.62} />
</div>
```

**In a tab header**

```tsx
<button className="tab">
  avatar <FillWord word="loading" value={0.62} />
</button>
```

## Accessibility

The accessible name gives the task and its state: **"storage: 40% complete."** In drain mode, where `value` is the
fraction already drained, `value={0.7}` reads **"expiring: 30% remaining."** An empty word reads "No data." The
interactive entry glides the ink edge with a reduced-motion-gated clip-path transition and announces changes through a
polite live region, throttled to at most once a second so a streaming value doesn't spam a screen reader.

This chart is a single unit, so there is nothing to rove between: a click, tap, `Enter` or `Space` selects it
and fires `onSelect`, and no selection stays pinned. That is the scalar half of the shared
[interaction contract](/docs/accessibility#one-interaction-contract).
Hover or focus also reveals the reading itself in a floating chip, for the sizes and label modes where the mark
does not print it; `readout={false}` drops the chip and keeps everything else.

## Props

| Prop | Type | Description |
| --- | --- | --- |
| `word` (required) | `string` | The text that is the chart. |
| `value` (required) | `number` | Fraction 0–1 (clamped). |
| `mode` | `"fill" \| "drain"` | fill grows the ink (complete); drain empties it (remaining / TTL). |
| `label` | `"none" \| "value"` | Append the percent numeral after the word. |
| `fontSize` | `number` | Word type size in viewBox units (default 12) — here the word is the mark, so this sizes the chart. |
| `animate` | `boolean` | (interactive) Opt-in entrance motion when the chart mounts client-side — add `import "@microcharts/react/motion"` once. Inert on the server, on hydrated server HTML, and under `prefers-reduced-motion`. |

Plus the shared grammar — `data`, `domain`, `color`, `title`, `summary`, `format` — and the layout props (`width`, `height`, `className`, `style`) that every chart accepts. Interactive entries also share `animate` and `live`, and — wherever a chart has more than one navigable unit — `onActive`, `onSelect`, `selectedIndex` and `defaultSelectedIndex`; and — wherever the chart shows a hover value — `readout`. See [the shared grammar](/docs/quickstart#the-shared-grammar).
