# Icon Tile

A tinted square holding an icon, saying what kind of thing a row or panel is. It's decorative: the text beside it names the thing. Tones come from the status palette, with the icon in the tone's text colour.

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

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

## Best practices

- Do: Use `size` 40 in a panel header, 32 in a workspace row and 28 in a dense list, so the tile stays in proportion with the text beside it.
- Do: Name the thing in text beside the tile, like "Matter details". The tile is hidden from screen readers.
- Do: Keep one tone for one kind of thing across the CRM, so a lawyer learns that a colour means, say, a document.
- Don't: Use a tile's tone as the only sign of a status, like overdue. Colour alone says nothing to some readers; use `Badge` with the word.
- Don't: Make a tile clickable. It has no name or focus state; use an `IconButton`, which needs an `aria-label`.

## Related

- [Avatar](./avatar.md)
- [Badge](./badge.md)
- [Status Mark](./status-mark.md)

## Examples

What the examples import:

```tsx
import { FolderClosed } from "lucide-react";
import { Fragment } from "react";
import { IconTile, type IconTileTone } from "@leap-crm/design-system";
```

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

```tsx
const tones: IconTileTone[] = [
  "info",
  "neutral",
  "success",
  "purple",
  "teal",
  "warning",
  "yellow",
  "slate",
  "destructive",
];
```

### Tones and sizes

40 (8 px radius, 20 px icon) for panel headers, 32 (8 px, 16 px) in workspace rows, 28 (4 px, 14 px) in dense lists.

```tsx
<div className="grid grid-cols-[auto_repeat(9,auto)] items-center justify-start gap-x-3 gap-y-3">
  <span />
  {tones.map(tone => (
    <span key={tone} className="text-caption text-neutral-text-muted">
      {tone}
    </span>
  ))}
  {([40, 32, 28] as const).map(size => (
    <Fragment key={size}>
      <span className="text-small text-neutral-text-muted">{size}</span>
      {tones.map(tone => (
        <IconTile
          key={`${size}-${tone}`}
          tone={tone}
          size={size}
          icon={<FolderClosed />}
        />
      ))}
    </Fragment>
  ))}
</div>
```

### In a row

The row's text names it; the tile only adds the kind.

```tsx
<div className="flex items-center gap-3">
  <IconTile tone="info" icon={<FolderClosed />} />
  <span className="flex flex-col">
    <span className="text-body font-book text-neutral-text">
      Correspondence
    </span>
    <span className="text-small text-neutral-text-muted">
      12 documents
    </span>
  </span>
</div>
```

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `icon` (required) | `ReactNode` |  | The icon, drawn in the tone's text colour at 14, 16 or 20 px. |
| `tone` | `Exclude<Tone, "default" \| "plum"> \| "neutral"` | `"info"` | The tile's colour: one of the status tones, or neutral. |
| `size` | `28 \| 32 \| 40` | `32` | 40 for panel headers, 32 in workspace rows, 28 in dense lists. |
| `className` | `string` |  | Classes added to the root element, merged with its own. Tokens only. |
