Exhaustive Icons
SVG icons in Round and Sharp styles, drawn inline by p-icon: no font, no extra request, no layout shift, and only the icons an app imports in its bundle.
Why #
@exhaustive-ui/icons is the SVG icon set of ExhaustiveUI: 278 icons drawn on a 24×24 grid in two styles, Round and Sharp, each with Light, Regular, Bold and Solid variants. An icon is a constant holding one SVG path, and the p-icon component of @exhaustive-ui/core/icon draws it as inline SVG.
- No font and no extra request: an app ships only the icons it imports, inside its JavaScript, instead of the whole font file and its stylesheet.
- No render-blocking CSS: the few lines of CSS of the component are added by Angular with the component, and inlined in the page with SSR.
- No layout shift: the svg has its size as attributes (1em), so it takes its final place before any CSS or font loads, and never flashes as an empty box or a missing glyph.
- Follows the text: size, color and, with Tailwind, the stroke weight come from the surrounding text.
- Typed: a missing icon is a compile error, and editors show a preview of each icon.
The @openng/icons font that the PrimeNG migration installs keeps working: pi pi-* classes are still accepted as strings, so the two can be used side by side, and the icons migration moves a project to the SVG icons.
Installation #
The icons are a separate package; the component is part of @exhaustive-ui/core. No stylesheet or asset needs to be added to the build.
npm install @exhaustive-ui/iconsUsage #
Import the icons from @exhaustive-ui/icons/round or @exhaustive-ui/icons/sharp and pass them to the icon input. Each icon is a constant named after the icon in camel case: arrow-down-left is arrowDownLeft. Only the imported icons end up in the bundle.
<p-icon> renders an svg inside the p-icon element. On an svg element, pIcon renders the svg alone, with one path: the smallest markup, recommended for lists and tables with many icons.
import { Component } from '@angular/core';
import { Icon, SvgIcon } from '@exhaustive-ui/core/icon';
import { check, search, times, user } from '@exhaustive-ui/icons/round';
@Component({
selector: 'app-toolbar',
imports: [Icon, SvgIcon],
template: `
<p-icon [icon]="check" />
<p-icon [icon]="times" />
<svg pIcon [icon]="search"></svg>
<svg pIcon [icon]="user"></svg>
`
})
export class Toolbar {
check = check;
times = times;
search = search;
user = user;
}Components #
Every icon input and option of the components takes an icon constant as well as a CSS class: icon of Button, Tag, Chip or Message, loadingIcon, dropdownIcon, closeIcon, and the icon of MenuItem, TreeNode, ToastMessageOptions or Confirmation. The component draws it as an inline svg with the classes and pass-through options of its icon element, so the theme sizes and spaces it as before. A string keeps rendering the class, and the IconValue type of @exhaustive-ui/core/types/icon accepts both.
In a custom template, iconData() and iconClass() of @exhaustive-ui/core/icon tell the two forms apart.
<p-button label="Save" [icon]="check" />
<p-button label="Download" [icon]="download" severity="secondary" iconPos="right" />
<p-tag value="Featured" [icon]="starSolid" severity="warn" />
<p-menu [model]="items" />Solid #
Every icon has a solid variant, a separate constant with the Solid suffix such as starSolid, filled with the current color. Icons made of lines only (arrows, chevrons, check, plus...) have no shape to fill: their Solid constant, such as checkSolid, is the same path drawn at the Bold width of its style, whatever the weight of the text. It reuses the path of the stroke constant, so importing both costs only a few bytes.
import { check, checkSolid, star, starSolid } from '@exhaustive-ui/icons/round';
// template
<p-icon [icon]="favorite() ? starSolid : star" />
<p-icon [icon]="done() ? checkSolid : check" />Weight #
Stroke icons come in three weights that share the same drawing: light, regular (the default) and bold. The weight input sets one explicitly; without it, the weight follows the text through two CSS variables, see Tailwind and CSS variables.
| Weight | Round stroke | Sharp stroke |
|---|---|---|
| light | 1.25 | 1.25 |
| regular | 1.75 | 1.5 |
| bold | 2.25 | 2 |
<p-icon [icon]="cog" weight="light" />
<p-icon [icon]="cog" weight="regular" />
<p-icon [icon]="cog" weight="bold" />
<p-icon [icon]="cogSolid" />Tailwind #
An icon is drawn at 1em in currentColor, so the text utilities style it with no icon-specific class:
- Size: text-sm, text-2xl... on the icon or its parent. A size utility such as size-8 on the icon also works, the icon CSS has zero specificity.
- Color: text-green-700, text-primary...
- Weight: with the @exhaustive-ui/tailwindcss plugin, the font weight utilities also set the stroke weight: font-thin, font-extralight and font-light draw light strokes, font-normal and font-medium regular strokes, font-semibold to font-black bold strokes. A font-semibold button label gets bold icons with no extra work.
<span class="text-sm font-light text-green-700 dark:text-green-400"><p-icon [icon]="check" /> Saved</span>
<span class="text-xl font-semibold text-orange-700 dark:text-orange-400"><p-icon [icon]="exclamationTriangle" /> Check the form</span>
<span class="text-3xl font-black"><p-icon [icon]="download" /> Download</span>CSS Variables #
Without Tailwind, set the stroke width with two inherited CSS variables, --p-icon-stroke-round (1.75 by default) and --p-icon-stroke-sharp (1.5 by default), on any element: every icon inside follows. Size and color come from font-size and color.
/* bold icons in headings and buttons */
h1, h2, .p-button-label {
--p-icon-stroke-round: 2.25;
--p-icon-stroke-sharp: 2;
}
/* light icons in a dense table */
.p-datatable {
--p-icon-stroke-round: 1.25;
--p-icon-stroke-sharp: 1.25;
}
/* a larger, colored icon */
.status p-icon {
font-size: 1.5rem;
color: var(--p-green-600);
}Names #
To refer to icons by name, for instance from data or a menu model, register them with provideIcons and use the name input. An icon is registered under its key and its kebab case name, so arrowDownLeft and arrow-down-left both work. Only the registered icons are bundled. provideIcons works in the application, route and component providers, and adds to the icons of the parent injectors.
// app.config.ts
import { provideIcons } from '@exhaustive-ui/core/icon';
import { check, pencil, trash } from '@exhaustive-ui/icons/round';
export const appConfig = {
providers: [provideIcons({ check, pencil, trash })]
};
// any template
<p-icon name="trash" />
<p-icon [name]="item.icon" />The list of every icon name is exported by @exhaustive-ui/icons/names as ICON_NAMES, with the IconName type. It is a separate entry point so that it never lands in an app bundle by accident: use it for tooling or an icon picker, not to register all icons.
import { ICON_NAMES, type IconName } from '@exhaustive-ui/icons/names';Spin #
spin rotates the icon continuously, for a loading indicator. The icon stays still when the user prefers reduced motion; give the loading state a text or a label so it is not conveyed by the motion alone.
<p-icon [icon]="spinner" spin label="Loading" />Round and Sharp #
Both styles have the same icons under the same names. Round has round caps and joins and softened corners, for a friendly interface. Sharp has square caps, miter joins, 45° angles and a cut corner on containers, for a technical or editorial look. Pick one per app; the entry point is the only difference.
import { calendar } from '@exhaustive-ui/icons/round';
// or
import { calendar } from '@exhaustive-ui/icons/sharp';Accessibility #
Screen Reader
An icon is decorative by default: the svg has aria-hidden="true" and focusable="false", and the text next to it conveys the meaning. When an icon carries meaning on its own, set label: the svg gets role="img" and the label as aria-label, and is no longer hidden. An icon-only button is labelled by the button itself (aria-label on the button), not by the icon.
<!-- decorative: hidden from assistive technologies -->
<span><p-icon [icon]="check" /> Saved</span>
<!-- meaningful on its own -->
<p-icon [icon]="exclamationTriangle" label="Warning" />
<!-- icon-only button: label the button -->
<button type="button" aria-label="Delete"><p-icon [icon]="trash" /></button>Contrast and motion
Icons use the current text color, so they meet the contrast of the text. The light weight is meant for large sizes; keep regular or bold below 20px. spin stops when the user prefers reduced motion.
Migrating from the icon font #
The icons-migration schematic moves an application from the @openng/icons font to these icons. It also runs once with ng update, with the default options, and can be run again at any time: a second run changes nothing.
ng generate @exhaustive-ui/core:icons-migration
ng generate @exhaustive-ui/core:icons-migration --style=sharp --inputs --remove-fontAn empty <i> or <span> whose static class names one icon becomes svg[pIcon], in inline and external templates. The other classes and attributes stay, pi-spin becomes spin, pi-fw is dropped and aria-label becomes label. The icon is imported and exposed on the component, renamed iconCheck when the component already has a check; SvgIcon is added to the imports of the component, or of the NgModule declaring it, and @exhaustive-ui/icons to package.json. The renamed font icons follow data/aliases.json: pi-star-fill becomes starSolid.
<!-- before -->
<i class="pi pi-check text-xl" aria-hidden="true"></i>
<p-button icon="pi pi-trash" />
<!-- after, the button with --inputs -->
<svg pIcon [icon]="check" class="text-xl" aria-hidden="true"></svg>
<p-button [icon]="trash" />
// the component
import { SvgIcon } from '@exhaustive-ui/core/icon';
import { check, trash } from '@exhaustive-ui/icons/round';
@Component({ imports: [SvgIcon], ... })
export class App {
protected readonly check = check;
protected readonly trash = trash;
}- --style=sharp imports the icons from @exhaustive-ui/icons/sharp instead of round.
- --inputs also rewrites the icon input of the components, icon="pi pi-check" to [icon]="check", and the 'pi pi-check' strings and OpenngIcons constants set as the icon of a TypeScript object, such as a menu item. It requires @exhaustive-ui/core 22.13 or later.
- --remove-font removes the font stylesheet from angular.json and the global stylesheets, and the @openng/icons dependency, once no pi- class is left.
- --path limits the migration to a folder, --skip-install leaves the install to you.
Bound or interpolated class lists ([ngClass], [class]="'pi pi-' + name", an interpolation), brand logos, which this set does not draw, and unknown names are left as they are, and listed at the end with their file and line, along with what the options would rewrite.
Gallery #
Every icon, in both styles and all variants. Hover an icon for the name of its constant. The gallery loads the data of all icons, about 55 KB compressed, only when it scrolls into view, so this page stays light; an app only bundles the icons it imports.
The gallery loads when it scrolls into view.
Performance #
Measured on a production build (Angular 22, esbuild) of an app that already uses ExhaustiveUI components, before and after adding p-icon with 20 common icons, compared with the icon font.
| Measure | Exhaustive Icons, 20 icons | OpenNG Icons font |
|---|---|---|
| Bytes downloaded | +2.1 KB gzip in the app bundle (component and CSS 1.2 KB, icons 0.9 KB) | 35.1 KB woff2 font + 17 KB CSS (2.9 KB gzip), whatever the number of icons used |
| Requests | none | 1 font, plus the CSS when it is not bundled |
| Render-blocking CSS | none, about 500 bytes of CSS added with the component, inlined with SSR | the icon CSS in the global stylesheet |
| Layout shift and flash | none: the svg has its size as attributes | icons are invisible until the font loads |
| One more icon | about 45 bytes gzip on average, 0 when not imported | 0, every icon is always downloaded |
A stroke icon is one path of about 100 bytes on average, shared by the three weights, so changing the weight costs nothing. A CI check keeps every stroke path under 700 bytes and the component under a fixed size budget, and a test bundles three icons to verify that the others are dropped.