# Tag chip

A label the user wrote: a grey rectangle at the chip radius, an optional mark, and a remove button with a 24px hit area.

Section: Components / Data display
Page: https://ui.heyramzi.com/components/tag-chip
Import path: `@heyramzi/ui/components/chip`

## Import

```ts
import { TagChip } from "@heyramzi/ui/components/chip";
```

## Demo

```svelte
<script lang="ts">
	import { TagChip } from "@heyramzi/ui/components/chip";
	import { Tag } from "phosphor-svelte";

	let tags = $state(["Onboarding", "Invoices", "A label long enough to truncate inside its chip"]);
</script>

<div class="flex w-full max-w-sm flex-wrap items-center gap-1.5">
	<TagChip>Read only</TagChip>
	<TagChip>
		{#snippet icon()}<Tag aria-hidden="true" />{/snippet}
		With an icon
	</TagChip>
	{#each tags as tag (tag)}
		<TagChip
			class="max-w-48"
			removeLabel={`Remove ${tag}`}
			onRemove={() => {
				tags = tags.filter((t) => t !== tag);
			}}
		>
			{tag}
		</TagChip>
	{/each}
</div>
```

## API

| Prop | Type | Default | Notes |
| --- | --- | --- | --- |
| `icon` | `Snippet` |  | A leading mark: a tag icon, a colour dot, an avatar. |
| `onRemove` | `() => void` |  | Shows a remove button after the label. |
| `removeLabel` | `string` | `"Remove"` | The remove button's accessible name. |
| `removeFocusable` | `boolean` | `true` | False keeps the remove button out of the tab order and stops it taking focus on press, for a chip inside a field whose input owns the keyboard (Backspace removes). |
| `children` | `Snippet` |  |  |
| `class` | `string` |  |  |

Every prop of `HTMLAttributes<HTMLSpanElement>` from `svelte/elements`, except `children, class`.
