Icons: @cssints/icons

An icon is a style written on scope() (one scope, "icons", whatever the collection): a marker class, a mask kernel and one atomic class per icon that holds the SVG as a data URL. There is no runtime. Install @cssints/icons and a collection (@iconify-json/mdi), or point it at a folder of .svg files.

import { const cn: (...styles: Style[]) => Stylecn, const color: Prop<"color">
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
, const width: Prop<"width">
`auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/width)
width
} from "cssints" with { type: "cssints" };
import { const icons: <C extends Collection = Collection>(options: Options) => Icons<IconName<C>>
Icons from the `@iconify-json/<collection>` package installed in the project (read from `node_modules` when the module runs; the project is the working directory), or from the `.svg` files of a directory (relative to the working directory, named without the extension). Say which collection in the type argument to have the names checked as you type: `icons<typeof import("@iconify-json/mdi/icons.json")>({ provider: "iconify-json", collection: "mdi" })`. A name that does not exist is a build error that suggests the nearest one. One scope, "icons", whatever the collection: its kernels are the same, and `build` is the same code, which the engine takes as one definition however many times `icons()` runs.
@paramoptions where the icons come from@returnsa function of the icon name: a style for `cn()`
icons
} from "@cssints/icons" with { type: "cssints" };
// icons.ts: a build-time module (it runs while the build runs, and never reaches the browser) export const
const mdi: Icons<IconName<{
    prefix: string;
    icons: {
        "ab-testing": {
            body: string;
        };
        abacus: {
            body: string;
        };
        "abjad-arabic": {
            body: string;
        };
        "abjad-hebrew": {
            body: string;
        };
        "abugida-devanagari": {
            body: string;
        };
        "abugida-thai": {
            body: string;
        };
        "access-point": {
            body: string;
        };
        "access-point-check": {
            body: string;
        };
        "access-point-minus": {
            body: string;
        };
        "access-point-network": {
            body: string;
        };
        "access-point-network-off": {
            body: string;
        };
        "access-point-off": {
            body: string;
        };
        "access-point-plus": {
            body: string;
        };
        "access-point-remove": {
            body: string;
        };
        account: {
            body: string;
        };
        "account-alert": {
            body: string;
        };
        "account-alert-outline": {
            ...;
        };
        ... 7620 more ...;
        "zodiac-virgo": {
            ...;
        };
    };
    aliases: {
        ...;
    };
    lastModified: number;
    width: number;
    height: number;
}>>
mdi
=
icons<{
    prefix: string;
    icons: {
        "ab-testing": {
            body: string;
        };
        abacus: {
            body: string;
        };
        "abjad-arabic": {
            body: string;
        };
        "abjad-hebrew": {
            body: string;
        };
        "abugida-devanagari": {
            body: string;
        };
        "abugida-thai": {
            body: string;
        };
        "access-point": {
            body: string;
        };
        "access-point-check": {
            body: string;
        };
        "access-point-minus": {
            body: string;
        };
        "access-point-network": {
            body: string;
        };
        "access-point-network-off": {
            body: string;
        };
        "access-point-off": {
            body: string;
        };
        "access-point-plus": {
            body: string;
        };
        "access-point-remove": {
            body: string;
        };
        account: {
            body: string;
        };
        "account-alert": {
            body: string;
        };
        "account-alert-outline": {
            ...;
        };
        ... 7620 more ...;
        "zodiac-virgo": {
            ...;
        };
    };
    aliases: {
        ...;
    };
    lastModified: number;
    width: number;
    height: number;
}>(options: Options): Icons<...>
Icons from the `@iconify-json/<collection>` package installed in the project (read from `node_modules` when the module runs; the project is the working directory), or from the `.svg` files of a directory (relative to the working directory, named without the extension). Say which collection in the type argument to have the names checked as you type: `icons<typeof import("@iconify-json/mdi/icons.json")>({ provider: "iconify-json", collection: "mdi" })`. A name that does not exist is a build error that suggests the nearest one. One scope, "icons", whatever the collection: its kernels are the same, and `build` is the same code, which the engine takes as one definition however many times `icons()` runs.
@paramoptions where the icons come from@returnsa function of the icon name: a style for `cn()`
icons
<typeof import("@iconify-json/mdi/icons.json")>({
provider: "iconify-json"provider: "iconify-json", collection: stringcollection: "mdi", }); export const const brand: Icons<string>brand = icons<Collection>(options: Options): Icons<string>
Icons from the `@iconify-json/<collection>` package installed in the project (read from `node_modules` when the module runs; the project is the working directory), or from the `.svg` files of a directory (relative to the working directory, named without the extension). Say which collection in the type argument to have the names checked as you type: `icons<typeof import("@iconify-json/mdi/icons.json")>({ provider: "iconify-json", collection: "mdi" })`. A name that does not exist is a build error that suggests the nearest one. One scope, "icons", whatever the collection: its kernels are the same, and `build` is the same code, which the engine takes as one definition however many times `icons()` runs.
@paramoptions where the icons come from@returnsa function of the icon name: a style for `cn()`
icons
({ provider: "fs"provider: "fs", dir: stringdir: "src/icons" });
// a component imports them from there: import { mdi, brand } from "./icons.ts" with { type: "cssints" } export const const close: Styleclose = function cn(...styles: Style[]): Stylecn(
const mdi: (name: IconName<{
    prefix: string;
    icons: {
        "ab-testing": {
            body: string;
        };
        abacus: {
            body: string;
        };
        "abjad-arabic": {
            body: string;
        };
        "abjad-hebrew": {
            body: string;
        };
        "abugida-devanagari": {
            body: string;
        };
        "abugida-thai": {
            body: string;
        };
        "access-point": {
            body: string;
        };
        "access-point-check": {
            body: string;
        };
        "access-point-minus": {
            body: string;
        };
        "access-point-network": {
            body: string;
        };
        "access-point-network-off": {
            body: string;
        };
        "access-point-off": {
            body: string;
        };
        "access-point-plus": {
            body: string;
        };
        "access-point-remove": {
            body: string;
        };
        account: {
            body: string;
        };
        "account-alert": {
            body: string;
        };
        "account-alert-outline": {
            ...;
        };
        ... 7620 more ...;
        "zodiac-virgo": {
            ...;
        };
    };
    aliases: {
        ...;
    };
    lastModified: number;
    width: number;
    height: number;
}>) => Style
mdi
("close"), color<readonly ["crimson"]>(parts_0: "crimson"): Style
`<color>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/color)
color
("crimson"), width<readonly ["1.5em"]>(parts_0: "1.5em"): Style
`auto | <length-percentage [0,∞]> | min-content | max-content | fit-content | fit-content(<length-percentage [0,∞]>) | <calc-size()> | <anchor-size()>`. Chrome 1, Edge 12, Firefox 1, Safari 1, iOS 1, Android 18. [MDN](https://developer.mozilla.org/docs/Web/CSS/width)
width
("1.5em"));
export const const logo: Stylelogo = const brand: (name: string) => Stylebrand("logo"); export const const typo: Styletypo =
const mdi: (name: IconName<{
    prefix: string;
    icons: {
        "ab-testing": {
            body: string;
        };
        abacus: {
            body: string;
        };
        "abjad-arabic": {
            body: string;
        };
        "abjad-hebrew": {
            body: string;
        };
        "abugida-devanagari": {
            body: string;
        };
        "abugida-thai": {
            body: string;
        };
        "access-point": {
            body: string;
        };
        "access-point-check": {
            body: string;
        };
        "access-point-minus": {
            body: string;
        };
        "access-point-network": {
            body: string;
        };
        "access-point-network-off": {
            body: string;
        };
        "access-point-off": {
            body: string;
        };
        "access-point-plus": {
            body: string;
        };
        "access-point-remove": {
            body: string;
        };
        account: {
            body: string;
        };
        "account-alert": {
            body: string;
        };
        "account-alert-outline": {
            ...;
        };
        ... 7620 more ...;
        "zodiac-virgo": {
            ...;
        };
    };
    aliases: {
        ...;
    };
    lastModified: number;
    width: number;
    height: number;
}>) => Style
mdi
("clos"); // error: not an icon of mdi
Argument of type '"clos"' is not assignable to parameter of type 'IconName<{ prefix: string; icons: { "ab-testing": { body: string; }; abacus: { body: string; }; "abjad-arabic": { body: string; }; "abjad-hebrew": { body: string; }; "abugida-devanagari": { body: string; }; "abugida-thai": { ...; }; ... 7631 more ...; "zodiac-virgo": { ...; }; }; aliases: { ...; }; lastModified: num...'.
/* kernel icons.mask, layer _.k; LightningCSS adds -webkit-mask for your targets */
._icons-mask { display: inline-block; width: 1em; height: 1em; background-color: currentColor; mask: var(--icons-svg) no-repeat center / 100% 100%; }
/* the only per-icon rule */
._x1 { --icons-svg: url("data:image/svg+xml,%3Csvg …"); }