# Icons

> Source: https://design.nanatec.co.ke/guides/icons/
> Nana UI uses Heroicons, outline and solid, by name in the web components and as data in Svelte.

Every icon is from [Heroicons](https://heroicons.com) 2.2, the MIT-licensed set
by the makers of Tailwind CSS. Names match the Heroicons site. Outline icons use
the plain name; the solid version adds `-solid`.

```html
<nana-icon name="magnifying-glass" size="lg"></nana-icon>
<nana-icon name="bell" size="lg"></nana-icon>
<nana-icon name="cog-6-tooth" size="lg"></nana-icon>
<nana-icon name="star-solid" size="lg"></nana-icon>
<nana-icon name="check-circle-solid" size="lg"></nana-icon>
```

## Web components

```html
<nana-icon name="arrow-path"></nana-icon>
<nana-icon name="trash" label="Delete"></nana-icon>
```

An icon without a `label` is hidden from assistive technology. Give it a label
when it carries meaning on its own.

## Svelte

Svelte imports each icon as data, so a bundle only carries the icons it uses.

```svelte
<script lang="ts">
  import { NanaIcon } from '$lib/components/ui/icon';
  import { bellIcon, starSolidIcon } from '$lib/nana-ui/core/heroicons.js';
</script>

<NanaIcon icon={bellIcon} class="size-5" />
<NanaIcon icon={starSolidIcon} label="Favourite" class="size-5 text-warning" />
```

The export is the name in camel case with `Icon` on the end: `chevron-down` is
`chevronDownIcon` and `star-solid` is `starSolidIcon`.

## Your own icons

Register an icon once, at start-up, and use it by name. Draw it on a 24 × 24
grid; give it `stroke: 1.5` to match the outline set, or leave `stroke` out for
a filled shape.

```js
import { registerIcon } from "@nana-tec/ui-components";

registerIcon("meter", {
  viewBox: "0 0 24 24",
  stroke: 1.5,
  paths: ["M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Z", "M12 12l3.75-3.75"],
});
```

Registering an existing name replaces that icon everywhere, including inside
the components.

## All icons
