# Platform badge

> Where a post goes and whether it is there: outlined planned, filled published, dashed failed.

- Group: Data
- Status: stable
- Aliases: channel-badge
- HTML page: https://design.ipmnx.com/components/platform-badge/
- Spec: https://design.ipmnx.com/design/#nx-platform-badge

## Preview

**A post on three platforms**

```html
<span
    class="nx-platform nx-platform--linkedin nx-platform--published"
    title="LinkedIn: published">
  <svg class="nx-platform__icon" viewBox="0 0 24 24" width="16"
      height="16" fill="currentColor" aria-hidden="true"
      focusable="false">
    <path d="M20.45 20.45h-3.55v-5.57c0-1.33-.03-3.04-1.85-3.04-1.85
        0-2.14 1.45-2.14 2.94v5.67H9.35V9h3.41v1.56h.05c.48-.9
        1.64-1.85 3.37-1.85 3.6 0 4.27 2.37 4.27 5.46v6.28ZM5.34
        7.43a2.06 2.06 0 1 1 0-4.13 2.06 2.06 0 0 1 0 4.13ZM7.12
        20.45H3.56V9h3.56ZM22.22 0H1.77C.79 0 0 .77 0 1.73v20.54C0
        23.23.79 24 1.77 24h20.45c.98 0 1.78-.77 1.78-1.73V1.73C24
        .77 23.2 0 22.22 0Z"></path>
  </svg>
  <span class="nx-sr-only">LinkedIn: published</span>
</span>
<span class="nx-platform nx-platform--facebook nx-platform--planned"
    title="Facebook: planned">
  <svg class="nx-platform__icon" viewBox="0 0 24 24" width="16"
      height="16" fill="currentColor" aria-hidden="true"
      focusable="false">
    <path d="M9.1 23.69v-7.98H6.63v-3.67H9.1v-1.58c0-4.09 1.85-5.98
        5.86-5.98.76 0 2.07.15
        2.61.3v3.32c-.28-.03-.78-.05-1.39-.05-1.97 0-2.73.75-2.73
        2.69v1.3h3.92l-.67 3.67h-3.25v8.25C19.4 23.24 24 18.18 24
        12.04 24 5.42 18.63.04 12 .04S0 5.42 0 12.04c0 5.63 3.87
        10.35 9.1 11.65Z"></path>
  </svg>
  <span class="nx-sr-only">Facebook: planned</span>
</span>
<span class="nx-platform nx-platform--instagram nx-platform--failed"
    title="Instagram: failed">
  <svg class="nx-platform__icon" viewBox="0 0 24 24" width="16"
      height="16" fill="currentColor" aria-hidden="true"
      focusable="false">
    <g fill="none" stroke="currentColor" stroke-width="2">
      <rect x="2.5" y="2.5" width="19" height="19" rx="5.5"></rect>
      <circle cx="12" cy="12" r="4.25"></circle>
      <circle cx="17.6" cy="6.4" r="1.1" fill="currentColor"
          stroke="none"></circle>
    </g>
  </svg>
  <span class="nx-sr-only">Instagram: failed</span>
</span>
```

```tsx
<NxPlatformBadge
  platform="linkedin"
  name="LinkedIn"
  state="published"
  stateLabel="published"
  href={url}
/>
```

## API

### React props (NxKit)

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `platform` | `NxPlatform` |   | yes | linkedin \| facebook \| instagram \| x \| bluesky \| other |
| `name` | `string` |   | yes | Platform name for the accessible name. |
| `state` | `"planned" \| "published" \| "failed"` |   | yes | Shape encodes state, the label says it. |
| `stateLabel` | `string` |   | yes | Localised state. |
| `href` | `string` | `undefined` |   | Links to the live post. |

### Classes

| Class | Description |
| --- | --- |
| `.nx-platform--published` | Filled |
| `.nx-platform--failed` | Dashed danger border |

## Accessibility

- Accessible name = platform + state (sr-only text and title); never colour or shape alone.

## Do / Don't

- Do: Show one badge per platform a post targets.
- Don't use the platforms' brand colours. The state must read the same for all.

## Related

- [Badge](https://design.ipmnx.com/components/badge.md)
- [Stat strip](https://design.ipmnx.com/components/stat-strip.md)

---

Source: registry.js (NX Design System)
