Start here
  • InstallationAdd Nelumbo to a shadcn project
  • ThemingBrand accent, neutrals, dynamic color
  • Biology componentsSequences, maps, plates and trees
  • katalyx.bio

    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/icon

    Usage

    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.

    PropTypeDefaultNotes
    nameIconNameThe symbol's name, like favorite
    fillbooleanfalseFilled glyph
    weightnumber400Stroke weight, 100 to 700
    gradenumber0Fine weight adjustment without changing size, -50 to 200
    sizenumberSize in px. Also sets the optical size axis
    labelstringAccessible 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.

    VariableRangeNotes
    --icon-sizeany lengthDefaults to 1.25em; buttons set their own
    --icon-fill0 to 1
    --icon-wght100 to 700
    --icon-grad-50 to 200Nelumbo uses -25 in dark mode to cut glare
    --icon-opsz20 to 48Optical 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:

    app/layout.tsx
    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.