Icons in a design
This page is for designers who add icons. It answers: which icon sets the installation already has, how admin4 draws its icons, how to add one, and how to make icon-only controls accessible.
Contents
- What is already there
- Icons in a public design
- Icons in the administration (admin4)
- Class and file type icons
- Accessible icons
What is already there
| Set | Where | Used by |
|---|---|---|
| Bootstrap Icons 1.13.2 (SVG) | share/icons/bootstrap-icons/svg/ with its LICENSE | admin4 and admin4l, and the icon theme bootstrap-icons |
| Crystal | share/icons/crystal, crystal-admin | the classic class and file type icons |
| Font Awesome (CSS and font) | extension/sevenx_themes_simple/design/simple/stylesheets/libs/fontawesome/, the starter design's fonts/ | the simple and starter designs |
share/icons/ and, since 6.0.15, the icon themes of extensions (extension/<name>/icons/) are served as static files
by the shipped rewrite rules.
Icons in a public design
For a handful of icons, ship SVG files in your design's images/icons/ and reference them:
<a class="social-link" href="$profile_url|wash">
<img src='icons/rss.svg'|ezimage alt="" width="20" height="20">
<span>'News feed'|i18n( 'design/mytheme' )</span>
</a>For icons that follow the text color, use them as CSS masks (the admin4 method below) or paste the SVG markup into a small template you include. Avoid loading a whole icon font for a few icons.
Icons in the administration (admin4)
admin4 draws Bootstrap Icons as CSS masks, colored by currentColor. components.css has one rule per icon name:
.a4-bi-gear { -webkit-mask-image: url(../../../share/icons/bootstrap-icons/svg/gear.svg);
mask-image: url(../../../share/icons/bootstrap-icons/svg/gear.svg); }and markup uses the class:
<span class="a4-icon a4-bi-gear" aria-hidden="true"></span>Settings name icons too: menu.ini tab icons (Icon=palette) and Setup tiles (LinkIcons[]) take names listed in
design.ini [AdminDesignSettings] IconList[]; a name not listed draws the plug icon (comment in settings/design.ini).
An extension that needs another Bootstrap icon adds its SVG, a .a4-bi-<name> rule in a stylesheet of
BackendCSSFileList[] and IconList[]=<name> in its design.ini.append.php.
Class and file type icons
The small icons for content classes and file types come from icon themes (settings/icon.ini). admin4 and admin4l use
the bootstrap-icons theme through [IconSettings] DesignTheme[]. An extension can ship its own icon theme; see
Icon themes in extensions.
Accessible icons
- An icon next to visible text is decoration:
aria-hidden="true"(oralt=""on an<img>). - An icon-only button needs a name: visible-to-screen-readers text (
<span class="a4-sr-only">in the admin, your own visually-hidden class elsewhere) oraria-label, and usually atitlefor mouse users. - Icons that point along the line (arrows, chevrons) are mirrored in right-to-left pages; admin4 does it with
scale: -1 1(Right-to-left designs). - Masked icons follow the text color, so they keep their contrast in dark mode.
Related pages
- Images in a design
- SVG images
- admin4 components
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.