Icons
Material Symbols Rounded as a variable font, with typed names and axes you can drive from CSS.
Nelumbo uses Material Symbols Rounded, a variable font, in place of lucide. Components that take an icon take
its name, such as <Button icon="add"> or <IconButton icon="favorite" label="Like" />.
npx shadcn@latest add @nelumbo/iconUsage
import { Icon } from "@/components/ui/icon"<Icon name="favorite" /><Icon name="favorite" fill /><Icon name="science" size={20} weight={500} /><Icon name="warning" label="Warning" />Names are typed (IconName), so a typo is a type error.
| Prop | Type | Default | Notes |
|---|---|---|---|
name | IconName | The symbol's name, like favorite | |
fill | boolean | false | Filled glyph |
weight | number | 400 | Stroke weight, 100 to 700 |
grade | number | 0 | Fine weight adjustment without changing size, -50 to 200 |
size | number | Size in px. Also sets the optical size axis | |
label | string | Accessible name. Without it the icon is decorative (aria-hidden) |
Axes as CSS variables
Each axis is a CSS variable, so a parent can drive the icons inside it without props. IconButton sets
--icon-fill: 1 when it's selected, and the glyph fills in with a transition.
| Variable | Range | Notes |
|---|---|---|
--icon-size | any length | Defaults to 1.25em; buttons set their own |
--icon-fill | 0 to 1 | |
--icon-wght | 100 to 700 | |
--icon-grad | -50 to 200 | Nelumbo uses -25 in dark mode to cut glare |
--icon-opsz | 20 to 48 | Optical size; match the rendered size in px |
Load the font
The full font is about 4.6 MB. Load a subset with only the symbols you use, a few KB, from Google Fonts:
import { materialSymbolsUrl, iconBaselineScript } from "@/components/ui/icon"<head> <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" /> <link rel="stylesheet" href={materialSymbolsUrl(["favorite", "settings"])} /> <script dangerouslySetInnerHTML={{ __html: iconBaselineScript }} /></head>iconBaselineScript is a tiny inline script that measures where the browser puts the font's baseline and
corrects it, because browsers disagree on the icon font's metrics and otherwise leave the glyph slightly high or
low. Render it once.
To self-host the whole font instead, import "material-symbols/rounded.css" once.
Collect the names automatically
Keeping the list by hand is easy to get wrong. Nelumbo, katalyx.bio and these docs each run a small script before
dev and build that finds every symbol name used in the source and writes the list to a file the layout
imports. It takes every string literal that is a real symbol name, so it over-includes a few common words
("link", "search"), at about 1 KB each, but never misses an icon. See
scripts/icons.ts in Nelumbo.
Other styles
Rounded is Nelumbo's default. To use Outlined or Sharp (Farfa, Nera and katalyx.bio use Sharp), pass the family to
materialSymbolsUrl and set --icon-font:
<link rel="stylesheet" href={materialSymbolsUrl(names, "Sharp")} />:root { --icon-font: "Material Symbols Sharp";}Try them under Customize theme in the sidebar.