Primitives
Icon
A glyph from the axi icon set. The class sizes the box; the drawing brings its own stroke and takes its ink from whatever it sits in.
The set is drawn to rule 12 - a 24 canvas, a 3px stroke, mitered joins, square corners, and no angle that is not 0, 45 or 90 degrees. Browse the whole of it on the icons page.
The class sets four things and deliberately nothing else: the two dimensions,
flex: none and the baseline offset. It sets no color, stroke or
fill, because an icon is whatever ink the thing containing it is written
in: put it inside a .axi-btn--primary and it turns accent-ink with the label.
flex: none is the load-bearing one. The commonest placement in the whole set
is beside a label inside a button, which is a flex container, and width: 1.25em
alone loses to flex-shrink there - the glyph arrives squashed.
The examples below reference #axi-<name> with no file part, because this site
inlines the sprite into every page. In your own app, point at the file:
<use href="node_modules/@axiapps/axi-design/dist/icons/sprite.svg#axi-search">,
which inherits currentColor the same way over http(s). A reference into a
separate file is same-origin, so under file:// - an Electron window opened
with loadFile() - it resolves to nothing instead; inline the sprite once and
use bare fragments there, as this site does.
On its own, and at a size
<span class="axi-row">
<svg class="axi-icon" aria-hidden="true"><use href="#axi-search"/></svg>
<svg class="axi-icon" style="--axi-icon-size: 2rem" aria-hidden="true"><use href="#axi-check"/></svg>
</span>
Beside a label
<button class="axi-btn axi-btn--primary" type="button">
<svg class="axi-icon" aria-hidden="true"><use href="#axi-search"/></svg>
Search
</button>
<button class="axi-btn" type="button">
<svg class="axi-icon" aria-hidden="true"><use href="#axi-x"/></svg>
Dismiss
</button>
Alone in a button, where the label is the accessible name
An icon-only control still needs a name - the glyph is aria-hidden and the button carries an aria-label<button class="axi-btn" type="button" aria-label="Close">
<svg class="axi-icon" aria-hidden="true"><use href="#axi-x"/></svg>
</button>
Knobs
| Property | Sets | Fallback |
|---|---|---|
--axi-icon-size | an .axi-icon's box, both dimensions | 1.25em |