Naming conventions
How Xerobi icons are named: lowercase hyphenated concepts, never a weight, stable after release, with aliases when a name has to change.
Last updated
A good icon name is predictable, searchable, short and accurate. Names are also public API: they become React component names (ShoppingCart), Flutter and Swift symbols, font classes, SVG file names and URLs.
Canonical names
A name must: [lint name]
- use lowercase ASCII letters and digits;
- join words with hyphens;
- describe the represented concept;
- be at most 40 characters;
- avoid abbreviations that are not widely known;
- stay the same after publication unless a correction is needed.
| Use | Not |
|---|---|
arrow-left |
ArrowLeft, arrow_left |
shopping-cart |
cart-new, shopping cart |
calendar-check |
thing-for-calendar |
user-circle |
left-arrow-icon-01 |
file-pdf |
pdf-file-document |
cloud-arrow-up |
cloud-arrow-shape |
Concept before appearance
Name an icon for what it represents, not for incidental drawing details. trash for the trash can, not bucket-with-lines. cloud-arrow-up for an upload to the cloud, not cloud-up-shape. If the icon is an action, use the established action word; if it is an object, its common name.
Never a weight
A name must not end in a weight: -fill, -filled, -outlined, -duotone, -bold, -thin, -regular. [lint name] The weight is chosen by the package: <House weight="fill" />, not <HouseFill />. house is the concept in all six weights.
The word outline or light can be part of a concept (selection-outline, traffic-light) and is fine.
Directions and states
Use these terms, and only these, for direction: left, right, up, down, up-left, up-right, down-left, down-right.
Use consistent modifiers where they mean something: plus, minus, check, x, slash, warning, question, open.
arrow-left chevron-down folder-open lock-open check-circle
Do not add a modifier that the base concept already implies. Do not use filled as part of a name for a style.
Variants
An icon that is another icon plus a modifier is named <base>-<modifier> and is built that way:
| Name | Is |
|---|---|
bell-slash |
bell plus a slash |
file-plus |
file plus the plus badge |
folder-lock |
folder with a lock drawn into it, marked data-badge="custom" |
The design specification lists the standard modifiers.
Parallel names
Related icons use parallel names, so people can guess one from another:
arrow-left,arrow-right,arrow-up,arrow-downchevron-left,chevron-right,chevron-up,chevron-downfile,file-plus,file-check,file-x
Use parallel naming only for icons that really belong to one set.
Singular and plural
Use singular for single objects: user, folder, image. Use plural only when it is a different concept: users is a group of people, not several users.
Abbreviations
Use an abbreviation only when it is established in its domain and helps: file-pdf, file-csv, wifi. Avoid private abbreviations that contributors and users cannot guess.
Avoid duplicates
Before you add a name:
- Search the set (
uv run scripts/icon.py search <words>). - Check spellings and synonyms.
- Check whether the concept already exists under another name.
- Decide whether the difference is meaning or only style.
- If the meaning is the same, use the existing icon, and add your word as a tag.
An icon that is drawn exactly like another must not be added. [lint dup] If two names truly belong to one concept, one is the icon and the other is an alias.
Source files
The source file is icons/<name>.svg, named exactly like the icon. All six weights come from that one file, so there are no per-weight folders and the weight never appears in a file name. The build writes the generated names:
| Package | Name for shopping-cart |
|---|---|
| React, Vue, React Native | ShoppingCart |
| Flutter | XerobiIcons.shoppingCart, XerobiIcons.bold.shoppingCart |
| SwiftUI | .shoppingCart |
| Compose | XerobiIcons.Regular.ShoppingCart |
| Icon font | im-shopping-cart |
| SVG files | shopping-cart.svg, shopping-cart-bold.svg |
Renaming
Once an icon is published, its name is a stable API. Rename only to correct a real spelling or meaning problem, and when you do:
- keep a deprecated alias (
aliases.json), so old code keeps working; - document the move in the release notes;
- never remove an alias except in a major version;
- never reuse a retired name for another drawing.
See Renaming or retiring an icon. [lint alias]