Icon Block

A block for icon, emoji, or image display.

🚀
<IconBlock size="md" icon={{ type: "emoji", emoji: "🚀" }} />

Installation

pnpm add @notion-kit/icon-block

Options


Size

Use the size prop to control the size of the button.

🚀
🚀
🚀
🚀
<IconBlock size="sm" icon={icon} />
<IconBlock size="md" icon={icon} />
<IconBlock size="lg" icon={icon} />
<IconBlock size="xl" icon={icon} />

Examples


Lucide Icon

<IconBlock
  size="md"
  icon={{ type: "lucide", name: "badge-euro", color: "#3e9392" }}
/>

Image Url

<IconBlock
  size="md"
  icon={{ type: "file", url: "https://github.com/shadcn.png" }}
/>

Text

J
<IconBlock size="md" icon={{ type: "text", text: "John" }} />

API Reference

IconBlock

PropTypeDefaultDescription
icon*IconData-The icon data.
size"sm" | "md" | "lg" | "xl""sm"The size of the block.
fallbackstring-The fallback string to display when an image can not be loaded.

type IconData

There are 4 types of icons:

  1. emoji: An emoji icon, whose src is simply the emoji string. See Emoji Cheat Sheet.
  2. lucide: A Lucide icon, whose src is the name of the icon. See Lucide Icons.
  3. url: An image URL. The image will be displayed in the block.
  4. text: A text string. Only the first letter of src will be displayed in the block.
PropTypeDescription
type*"emoji" | "lucide" | "url" | "text"The icon type.
src*stringThe source of the icon.
colorstringThe color of the lucide icon.

On this page