Skip to content
Mosaic
On this page

Icon

Renders a Mosaic glyph, hidden from assistive tech. A glyph can be swapped by name through the icons prop on MosaicProvider, and the override gets the same sizing. IconFrame is a square box that frames an icon or image.

Use for

  • an icon in a button, row or label
  • a leading or trailing icon in a button
  • a framed icon tile

Practices

GuidancePractice
DoSet placement when the icon leads or trails a Button label, so the button tightens that side.
DoUse size='inherit' for an icon in running text or a heading.
Don’tRely on the icon for the accessible name. It renders aria-hidden; name the control with text or aria-label.
Don’tExpect ref to reach an icon swapped through MosaicProvider. It only reaches the built-in glyph.

API reference

Icon

Renders the glyph as an svg, or its override. Takes its color from currentColor unless the container sets one.

Slot: cl-icon

PropTypeDescription
glyphIconComponentThe glyph component, from src/icons/glyphs.
size'sm' | 'md' | 'lg' | 'inherit'sm, md, lg, or inherit to follow the font size.Default: 'md'
placement'inline-start' | 'inline-end'Marks the icon as leading or trailing content, as data-icon. Applies no style of its own.

IconFrame

A square span that centers its content, sized to the media scale.

Slot: cl-icon-frame

PropTypeDescription
borderedbooleanDraws a subtle border.Default: true
filledbooleanFills the box with a neutral tint.Default: false
size'xs' | 'sm' | 'md' | 'lg'xs, sm, md or lg.Default: 'md'

Examples

A trailing icon in a button

TSX
<Button>
  Next
  <Icon glyph={ChevronRight} placement='inline-end' />
</Button>