Skip to main content
PimentCSS v1.0.1, what's new
Home

Icons

Dimensioned icon slots for any SVG or icon font. Phosphor is used in docs as a reference example only.

Principles

  • Slots, not glyphs: components reserve space and alignment; you provide SVG, an icon font, or inline markup.
  • currentColor: icons inherit semantic text colors (action, body, on-action) from the parent component.
  • One source per app: pick any library (Phosphor, Heroicons, Material Symbols, custom sprites) and use it consistently.
  • Accessible names: decorative icons beside visible text use aria-hidden="true"; icon-only controls need aria-label (see Accessibility guide).

Examples in context

Three common slots with Phosphor Regular (ph classes). Match the icon graphic size to the slot (20px in buttons, 24px in fields and alerts).

Phosphor as reference

Swap the markup for your own SVG set; slots stay the same.

Slot reference

Default sizes come from Sass variables in scss/abstracts/_variables.scss (!default, overridable via @use "pimentcss-design-system" with ()). The _icon-slot.scss partial scales child svg, .ph, and i[class*="ph-"] to fill the slot.

Slot classDefault sizeUsed in
.tag__icon1rem (16px)Tags
.checkbox__iconControl box (16px graphic)Checkboxes
.btn__icon, .btn-group__icon, .tab__icon, .table__icon, .tree__icon, .link__icon, .nav-item__icon1.25rem (20px)Buttons, Button group, Tabs, Table, Tree, Links, Navigation
.field__icon, .textarea-field__icon, .menu__item-icon1.5rem (24px)Input fields, Menu & dropdown
.alert__icon, .snackbar__icon, .pagination__item-icon, .carousel__arrow-icon1.5rem (24px)Alerts, Snackbar, Pagination, Carousel
.alert__close, .snackbar__link-icon1.25rem / 1remAlerts, Snackbar
.list__indicator-icon1rem graphic in 1.5rem indicatorList
.theme-toggle__option svgCustom sun/moon SVG (not a __icon slot)Theme toggle

Chevrons in selects and dropdowns may use CSS masks (.field--select, .dropdown__chevron) instead of an icon library.

Phosphor (documentation example)

To mirror the doc site, install Phosphor Web and load the Regular stylesheet once per app shell.

Set font-size on the ph element to match the slot (see table above). The slot box still comes from PimentCSS; Phosphor only draws the glyph.

Inline SVG

Prefer fill="currentColor" or stroke="currentColor" so light/dark semantics apply automatically.

Accessibility

Naming and visibility

  • Decorative (text or label already names the control): aria-hidden="true" on the icon, plus focusable="false" on SVG.
  • Icon-only: aria-label on the button or a; never leave the glyph as the only accessible name.
  • Meaningful standalone icons (rare): use visible text or aria-label on the control; do not rely on shape alone.

Touch targets for icon-only buttons use .btn--icon-only (min 44×44px). See Buttons: icon-only and Accessibility: touch targets.

Customize slot sizes (Sass)

After changing sizes, redraw or re-export icons from your library at the new pixel grid.