# Priority

A task's priority as four rising bars, the inactive ones at 25%, toned like its badge: low default, medium info, high warning, urgent and critical destructive. Critical turns the last bar into an exclamation mark. It's named for screen readers, so the bar count isn't the only signal.

- Beta: ready to use; its API can still change in a minor release.
- Category: Status & indicators

```tsx
import { Priority } from "@leap-crm/design-system";
```

## Best practices

- Do: Use it for a task's priority in a task row or table cell, where the bars take less room than a word.
- Do: Pass `label={null}` when the level is written beside the bars, so a screen reader doesn't hear it twice.
- Do: Keep `critical` for the few tasks that must not slip, like a limitation date. Its exclamation mark loses meaning when every task has one.
- Don't: Use it for a status or a stage, like Overdue or Enquired. Use `Badge`, which says the state in words.
- Don't: Recolour the bars with a class. Each level's tone matches its badge, and the bar count and name carry the level without colour.

## Related

- [Status Mark](./status-mark.md)
- [Badge](./badge.md)
- [Task row](./task-row.md)

## Examples

What the examples import:

```tsx
import { Priority, type PriorityLevel } from "@leap-crm/design-system";
```

Scaffolding the examples call. It lives in the docs page, not in the library:

```tsx
const levels: PriorityLevel[] = ["low", "medium", "high", "urgent", "critical"];
```

### Levels

```tsx
<div className="flex gap-6">
  {levels.map(level => (
    <span key={level} className="flex flex-col items-center gap-1">
      <Priority level={level} label={null} />
      <span className="text-small text-neutral-text-muted capitalize">
        {level}
      </span>
    </span>
  ))}
</div>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `level` (required) | `"low" \| "medium" \| "high" \| "urgent" \| "critical"` |  | low, medium, high, urgent or critical: how many bars fill, and their colour. |
| `label` | `string \| null` |  | What screen readers hear. "<Level> priority" by default; pass null when visible text beside it says so. |
| `className` | `string` |  | Classes added to the root element, merged with its own. Tokens only. |
