Skip to content
Nana UI

Guides

Icons

Nana UI uses Heroicons, outline and solid, by name in the web components and as data in Svelte.

View .md Download

Every icon is from Heroicons 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.

<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 imports each icon as data, so a bundle only carries the icons it uses.

<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.

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.

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.

324 of 324