# InterimBadge

> Marks content that is partial and still arriving: a streamed answer, a total before every source has reported, a draft figure. An outlined badge with a spinner and a word.

Source: https://docs.nasaqui.com/components/interim-badge

## Install

```bash
npx shadcn@latest add https://docs.nasaqui.com/r/interim-badge.json
```

A small outlined badge that says a value is not final yet. It pairs a spinner with a word ("Interim" /
"مبدئي"), so the state never depends on motion alone. Stop the spinner with `pending={false}` when nothing more
is coming but the figure is still provisional.

## When to use

- A number or answer shown before all of its data has arrived (streamed AI output, partial aggregates).
- A figure that may still change: preliminary results, an unaudited month.

## When not to use

- A region that has nothing to show yet: use `LoadingState`.
- A status that is final (draft, archived): use `Badge` with a variant.

## Import

```tsx
import { InterimBadge } from "@fadymondy/nasaq/web";
```

## Quick start

```tsx
<h3 className="flex items-center gap-2">
  Revenue this month <InterimBadge />
</h3>
```

## Anatomy

```
InterimBadge     data-slot="interim-badge" data-pending   (a Badge, variant="outline")
├─ Spinner       aria-hidden, only while pending
└─ label
```

## API

`InterimBadgeProps extends Omit<ComponentProps<"span">, "children">`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `label?` | `ReactNode` | `"Interim"` / `"مبدئي"` by provider locale | The word shown. |
| `pending?` | `boolean` | `true` | Shows the spinner. Turn it off when no more data is coming. |
| `className?` | `string` | none | Merged onto the badge. |

## Accessibility

- The label is real text, so the state is read with the value next to it. The spinner is decorative.
- If the value updates while someone reads it, announce the final value from a `role="status"` region; the badge
  itself is not a live region.

## RTL & i18n

The default label follows the Nasaq locale. The spinner and gap sit on the inline-start side in both directions.

## Styling & tokens

An outline badge with a `--nq-brand` tinted border. Extend with `className`.

## Do / Don't

- Do remove the badge once the value is final.
- Don't put it on every row of a table; mark the column header or the total instead.

## Related

- [Badge](https://docs.nasaqui.com/components/badge)
- [Spinner](https://docs.nasaqui.com/components/spinner)
- [States](https://docs.nasaqui.com/components/states)

## Lab

https://docs.nasaqui.com/?path=/docs/components-data-display-interim-badge--docs

## Code

### React

```tsx
<h3 className="flex items-center gap-2">
  Revenue this month <InterimBadge />
</h3>
```

### shadcn

```tsx
<h3 className="flex items-center gap-2">
  Revenue this month <InterimBadge />
</h3>
```

### Vue

```vue
<script setup lang="ts">
import { NqInterimBadge } from "@fadymondy/nasaq/vue";
</script>

<template>
  <div class="flex flex-col gap-3">
    <h3 class="flex items-center gap-2">
      Revenue this month <NqInterimBadge />
    </h3>
    <h3 class="flex items-center gap-2">
      Orders today <NqInterimBadge label="Provisional" />
    </h3>
    <h3 class="flex items-center gap-2">
      Closed period <NqInterimBadge :pending="false" label="Final" />
    </h3>
  </div>
</template>
```

### Blade

```blade
<div class="flex flex-col gap-3">
    <h3 class="flex items-center gap-2">
        Revenue this month <x-nq::interim-badge />
    </h3>
    <h3 class="flex items-center gap-2">
        Orders today <x-nq::interim-badge label="Provisional" />
    </h3>
    <h3 class="flex items-center gap-2">
        Closed period <x-nq::interim-badge :pending="false" label="Final" />
    </h3>
</div>
```

### HTML + Alpine

```html
<div class="flex flex-col gap-3">
    <h3 class="flex items-center gap-2">
        Revenue this month <span data-slot="interim-badge"     data-pending="true" class="inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded-[4px] border px-1.5 text-caption font-medium [&_svg]:size-3 border-nq-brand/40 text-foreground"><svg data-slot="spinner" aria-hidden="true" class="animate-spin motion-reduce:animate-none size-3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  <path d="M21 12a9 9 0 1 1-6.219-8.56"/>
</svg>    Interim</span>
    </h3>
    <h3 class="flex items-center gap-2">
        Orders today <span data-slot="interim-badge"     data-pending="true" class="inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded-[4px] border px-1.5 text-caption font-medium [&_svg]:size-3 border-nq-brand/40 text-foreground"><svg data-slot="spinner" aria-hidden="true" class="animate-spin motion-reduce:animate-none size-3" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
  <path d="M21 12a9 9 0 1 1-6.219-8.56"/>
</svg>    Provisional</span>
    </h3>
    <h3 class="flex items-center gap-2">
        Closed period <span data-slot="interim-badge"     class="inline-flex h-5 shrink-0 items-center gap-1 whitespace-nowrap rounded-[4px] border px-1.5 text-caption font-medium [&_svg]:size-3 border-nq-brand/40 text-foreground">Final</span>
    </h3>
</div>
```
