Skip to main content

Usage

Provide size for a square, or both width and height for custom dimensions. Components use those logical dimensions for the source and native display size; CSS can override the display. Use #rrggbbaa colors when you need transparency; SVG, PNG, and WebP preserve alpha, while JPEG composites transparent colors over white.

Props

integer
The size prop or hook option selects the square dimension form. Use it alone, never with width or height. Accepted range: 16-2048; logical area cannot exceed 4,194,304 pixels.
integer
The width prop or hook option selects the custom dimension form. Provide it with height, never with size. Accepted range: 16-4096; logical width multiplied by height cannot exceed 4,194,304 pixels.
integer
The height prop or hook option selects the custom dimension form. Provide it with width, never with size. Accepted range: 16-4096; logical width multiplied by height cannot exceed 4,194,304 pixels.
"svg" | "jpg" | "png" | "webp"
default:"svg"
The format prop or hook option selects the source encoding. Components and hooks default to SVG.
2 | 3
default:"standard density"
The density prop or hook option is only valid for JPG, PNG, and WebP. Omit it for standard density. After applying density, each source axis cannot exceed 4096 pixels and source area cannot exceed 4,194,304 pixels; logical display dimensions do not change.
string
default:"#f1eef8"
The background prop or hook option sets the fill color and must use #rrggbb or #rrggbbaa syntax.
string
default:"#6d28d9"
The color prop or hook option sets the label color and must use #rrggbb or #rrggbbaa syntax.
string
default:"width x height"
The text prop or hook option accepts up to 64 Unicode characters. Pass an empty string to suppress the label. The label is omitted when logical width is below 96 or logical height is below 64.
Text may appear in logs and public, cacheable URLs. Do not use sensitive information.