# Icon A **built-in** inline tag for dropping an icon *inside* text — a sentence, a list item, or a heading. It renders a Mantine ThemeIcon, so it carries the whole ThemeIcon surface — `variant`, `color`, `size`, `radius`, `gradient` — while still flowing inline. By default it's a bare glyph that **inherits the surrounding text's size and color**; add a `variant`/`color` to turn it into a Mantine icon chip. Use it as `{% icon "rocket" %}` in Markdown, or call it from Python logic (loops, snippets) via `component('aardvark', 'icon', 'rocket', …)`. The first argument is the icon, quoted. It can be a **[Tabler](https://tabler.io/icons) name** (a bare lowercase name like `rocket` or `brand-github`), a **[Font Awesome](https://fontawesome.com/icons) class** (`fa-solid fa-rocket`, `fab fa-github`), a path/URL to an **SVG or image file** (`/icons/folder.svg`), or an **emoji** (`🚀`). ## Demonstrations ### Inline glyphs A bare name renders an inline glyph that inherits the surrounding text's size and color: Launch it when you're ready, then star it on GitHub .
Source: Markdown ```aardvark Launch it {% icon "rocket" %} when you're ready, then star it {% icon "star" %} on GitHub {% icon "brand-github" %}. ``` Source: Python ```python page.print("Launch it " + component('aardvark', 'icon', 'rocket') + " when you're ready, then star it " + component('aardvark', 'icon', 'star') + " on GitHub " + component('aardvark', 'icon', 'brand-github') + ".") ``` ### Variants and colors Pass any Mantine ThemeIcon `variant` — `filled`, `light`, `outline`, `transparent` (the default), `white`, `default`, or `gradient` — with a `color` to turn the bare glyph into a chip. A gradient `variant` reads `gradientFrom`/`gradientTo`/`gradientDeg`:
Source: Markdown ```aardvark {% icon "rocket" variant="filled" color="blue" %} {% icon "heart" variant="light" color="pink" %} {% icon "star" variant="outline" color="yellow" %} {% icon "bell" variant="white" color="grape" %} {% icon "flame" variant="gradient" gradientFrom="orange" gradientTo="red" %} ``` Source: Python ```python component('aardvark', 'icon', 'rocket', variant='filled', color='blue') component('aardvark', 'icon', 'heart', variant='light', color='pink') component('aardvark', 'icon', 'star', variant='outline', color='yellow') component('aardvark', 'icon', 'bell', variant='white', color='grape') component('aardvark', 'icon', 'flame', variant='gradient', gradientFrom='orange', gradientTo='red') ``` `color` is a [Mantine color](https://mantine.dev/theming/colors/) name (`blue`, `pink`, …) or any CSS color. `autoContrast` flips the glyph between light/dark for legibility on its background. ### Size and radius `size` takes a Mantine size (`xs`–`xl`) or a number of pixels; `radius` takes a Mantine radius (`xs`–`xl`) or a number:
Source: Markdown ```aardvark {% icon "rocket" variant="filled" color="blue" size="xs" %} {% icon "rocket" variant="filled" color="blue" size="sm" %} {% icon "rocket" variant="filled" color="blue" size="lg" %} {% icon "rocket" variant="filled" color="blue" size="xl" radius="xl" %} ``` Source: Python ```python for s in ('xs', 'sm', 'lg', 'xl'): page.print(component('aardvark', 'icon', 'rocket', variant='filled', color='blue', size=s)) ``` With **no `size`**, the icon is `1em` and tracks the surrounding text — so a bare icon grows with whatever it sits in, including headings: ### Ship faster #### Built for teams ### Nudging and spacing A glyph sometimes sits a hair high or low for your text, or you want a little space around it. Use Mantine's margin/padding [style props](https://mantine.dev/styles/style-props/) — `mt`/`mb`/`ml`/`mr` (or the `mx`/`my`/`m` shorthands) for margin, and `pt`/`pb`/… (or `px`/`py`/`p`) for padding. A bare number is **pixels**, and negatives nudge: Lift it up, drop it down, or space it out.
Source: Markdown ```aardvark Lift it {% icon "star" mt=-2 %} up, drop it {% icon "star" mt=2 %} down, or space it {% icon "star" mx=8 %} out. ``` Source: Python ```python page.print("Lift it " + component('aardvark', 'icon', 'star', mt=-2) + " up, drop it " + component('aardvark', 'icon', 'star', mt=2) + " down, or space it " + component('aardvark', 'icon', 'star', mx=8) + " out.") ``` A named Mantine spacing works too (`mt="xs"`), and these apply to every variant. ### Tooltip and accessible name Give an icon a `label` and hovering (or focusing) it shows a Mantine **Tooltip** with that text. The label is also the icon's accessible name (it sets `aria-label`) and makes the icon keyboard-focusable, so the tooltip works without a mouse and a screen-reader user hears the name too. Use it when a **standalone** icon *is* the meaning and nothing adjacent already says it:
Source: Markdown ```aardvark {% icon "brand-github" label="View on GitHub" %} {% icon "rocket" variant="filled" color="blue" label="Deploy" %} ``` Source: Python ```python component('aardvark', 'icon', 'brand-github', label='View on GitHub') component('aardvark', 'icon', 'rocket', variant='filled', color='blue', label='Deploy') ``` Icons without a `label` are decorative — they're hidden from assistive tech (`aria-hidden`), and the surrounding text carries the meaning. **Don't `label` an icon that's the content of a link or button.** A labelled icon is its own keyboard focus stop, so wrapping one in an ``/`