Skip to content

Documentation

Put icons in an app with one name, or read them straight from the API.

In DiceX apps

The @dicex/design library registers icons.dicex.me as Iconify's provider the moment it is imported. So any icon of any set is drawn by its name: the prefix, a colon, the name.

tsx
import { Icon } from "@dicex/design";

<Icon icon="solar:home-2-linear" />

The same icon, from this very server.

The library's own icons (DESIGN_ICONS) are in its bundle and in the first paint; every other icon comes from this service. An icon that means something needs a label; otherwise it is decoration and hidden from screen readers.

In any other project

With Iconify's official client, give it this server's address and nothing else changes. Iconify's clients for other frameworks take the same address.

bash
npm install @iconify/react
tsx
import { addAPIProvider, Icon } from "@iconify/react";

addAPIProvider("", { resources: ["https://icons.dicex.me"] });

export const Home = () => <Icon icon="solar:home-2-linear" />;

The empty string is the default provider. The client asks only for the icons on the page, one request per set, and the browser keeps each answer for a week.

SVG addresses

Every icon is also an SVG file, for an img tag, CSS, email or a design tool. In an img, currentColor is black; give the colour you want with color.

  • No parameters: one em highhttps://icons.dicex.me/solar/home-2-linear.svg
  • With a sizehttps://icons.dicex.me/solar/home-2-linear.svg?height=48
  • With a colourhttps://icons.dicex.me/solar/home-2-linear.svg?height=48&color=%23e11d48
  • Turned and mirroredhttps://icons.dicex.me/solar/home-2-linear.svg?height=48&rotate=90deg&flip=horizontal
color
The colour; it replaces currentColor. Any CSS colour, and write # as %23 in the address.
width, height
Size: a number with any unit (48, 3rem) or auto, unset, none. Give one and the other follows the icon's proportions.
rotate
Rotation: 1 to 3 quarter turns, or 90deg, 180deg, 270deg, or 25%, 50%, 75%.
flip
Mirroring: horizontal or vertical, or both separated by a comma.
box
With 1, a transparent rectangle the size of the viewBox is added, for tools that do not read the viewBox.
download
With 1, the answer is an attachment and the browser saves the file.

API reference

This service speaks the official Iconify API: any client that works with it works with this server. Answers are JSON, except for SVG. Under each path there is a request ready to send, from this page to this server.

CORS
Answers are open to any page (Access-Control-Allow-Origin: *), and a plain GET is enough.
pretty
With pretty=1 the JSON answer is indented.
Caching
Icon data and SVGs are cached for a week (max-age=604800), lists and searches for an hour (max-age=3600).
Errors
An unknown set or icon is a 404 with the text Not found; a malformed request is a 400 with Bad request.

GET /{prefix}.json

The data of the icons asked for, in Iconify's JSON format, which is what clients draw from. A name the set lacks comes back in not_found.

icons
Icon names without the prefix, separated by commas. Required.

GET /collections

Every set that can be browsed, keyed by prefix: name, author, licence, number of icons, samples, grid height, category and palette.

prefix
Only this set, even if it is hidden.
prefixes
A comma-separated list. A name that ends with a dash stands for every prefix that starts with it (mdi- is mdi-light and the rest).
hidden
With 1, hidden sets are included.

GET /collection

The icon names of one set, by category: uncategorized, categories and total. aliases and hidden come only when the set has them.

prefix
The set's prefix. Required.
info
With 1, the set's info is included.
chars
With 1, the map of the set's font characters, if it has one.

GET /{prefix}/{name}.svg

One icon as a picture. Its parameters are in the SVG addresses section above.