Skip to main content
The package ships no glyph icons, so every icon comes from the app: an icon set, or an inline SVG of its own. Three things are asked of it:
  • aria-hidden, since the control around it carries the name. An IconButton takes its name from aria-label, and a field’s icon is decoration beside a label that already says what the field is for.
  • currentColor for fill or stroke, so the icon takes the colour the slot sets: muted in a field, the on-container role inside a filled button, and the disabled fade in either.
  • 1em square, which is what makes one icon serve every size.

Sizes each slot gives an icon

1em works because the slots that own an icon’s size set it as a font size, and the icon inherits it:

Rows set no icon size

The leading and trailing slots on a list item, a menu item, a tree item and an app bar set no icon size, so an icon there takes the size of the text beside it, 16px in a list row. Give an icon in one of those a size of its own:
An SVG with a viewBox and no size at all has no size to shrink from, so what it does depends on the slot. In an IconButton it fills the button edge to edge; in a field’s icon slot or a Button’s it collapses and draws nothing. Sizing it avoids both.