Icon Button
Material 3's four icon button styles, drawn with Material Symbols. As a toggle, the selected state fills the glyph and morphs the shape, so the change reads at a glance and not only through color.
Install
Installs Icon and Button with it. Then load the icon font (see Icons below).
npx shadcn@latest add @nelumbo/icon-buttonVariants
Ordered by emphasis. Standard suits toolbars and dense rows; filled marks the one key action in a group.
Toggle
Click to select. The icon's fill axis animates from outline to solid, and the corners tighten. Unselected toggles sit on a quiet container so both states look intentional.
standard
filled
secondary
outlined
Sizes and widths
Glyphs use the matching optical size, so a 20px icon is drawn for 20px, with sturdier strokes than a scaled-down 24.
size
width
Shape
Pill toggles become rounded squares when selected; square toggles become pills. Press and hold any of them to see the pressed morph as well.
pill
square
In context
A text toolbar of standard toggles, and player controls where the main action is wide and filled.
States
Icons
Nelumbo uses Material Symbols Rounded as a variable font. Every axis is a CSS variable, so components can drive icons without extra props. Try the axes below.
import { Icon } from "@/components/ui/icon"<Icon name="favorite" /> // decorative, 1.25em<Icon name="favorite" fill weight={500} /> // filled, heavier<Icon name="warning" size={20} label="Warning" /> // meaningful iconLoading the font. The full font is about 4.6 MB. In production, load only the icons you use, which is usually a few KB:
// app/layout.tsximport { materialSymbolsUrl } from "@/components/ui/icon"<link rel="stylesheet" href={materialSymbolsUrl(["favorite", "settings", "add"])} />// or self-host everything (simplest, heaviest):import "material-symbols/rounded.css"Props
Other props go to the underlying button, or to Radix Toggle when toggle is set.
| Prop | Type | Default | Notes |
|---|---|---|---|
| label | string | required | Accessible name, read by screen readers |
| icon | IconName | Material Symbols name, typed and autocompleted | |
| selectedIcon | IconName | Icon shown while selected (toggle only) | |
| variant | "standard" | "filled" | "secondary" | "outlined" | "standard" | |
| size | "xs" | "sm" | "default" | "lg" | "xl" | "default" | Buttons 28 to 56 px, icons 16 to 24 px |
| width | "narrow" | "default" | "wide" | "default" | |
| shape | "pill" | "square" | "pill" | Selection swaps pill and square |
| toggle | boolean | false | Makes it a Radix Toggle |
| pressed / defaultPressed / onPressedChange | Toggle state, same as Radix Toggle | ||
| loading | boolean | false |