Installation
pnpm dlx shadcn@latest add https://asciicn.dev/r/ember.jsonUsage
import { Ember } from "@/components/asciicn/ember";
export function Hero() {
return (
<section className="relative isolate min-h-[480px]">
<Ember intensity={0.6} className="absolute inset-0 -z-10" />
<h1>Your headline</h1>
</section>
);
}Tongues of flame rise from the bottom edge. Each one has its own height that rises and falls over several seconds, licks run up through it, and its edges fray. Near the tip, pieces tear off and the tongue carries on as a faint plume of smoke. A few sparks leave the flames, drift sideways on the wind, blink and go out. Just above the tongues, the rows waver a little, like air over a fire.
Every size is measured against the height of the flames, so the same fire works as a band along the bottom of a hero and as a box filled with fire. intensity sets that height: at 1 the tallest tongues reach about half the box, at 0.6 they stay in the lower third, and at 1.5 or more they fill a short strip.
In truecolor the coolest glyphs are a deep coal red, the body takes the flame colour, and the hottest glyphs mix toward the ink: pale gold on dark paper, deep copper on light paper. Smoke is the ink faded toward the paper. In palette mode the glyphs run paper, ink, flame by tone, so the hottest glyphs are the amber and the smoke fades into the paper.
It draws in standard by default. braille gives fine dots, and quadrants a blockier fire; both use blue-noise dithering so the smoke and the tips break into scattered dots.
Examples
Hero footer glow
An intensity of 0.6 keeps the fire in the lower third, so the headline sits on clear paper.
Card strip
A short strip along the bottom of a card. A high intensity fills the strip.
Braille
Eight dots per glyph, for a finer fire.
Props
| Prop | Type | Default |
|---|---|---|
| intensity How tall the flames reach, from 0 (none) to 2. At 1 the tallest tongues reach about half the box. | Type: number | Default 1 |
| wind Sideways wind, from -1 (to the left) to 1 (to the right). It leans the flames and carries the sparks and smoke. | Type: number | Default 0.2 |
| sparks How many sparks rise, from 0 (none) to 1. | Type: number | Default 0.5 |
| flame The flames in truecolor, the hottest glyphs in palette mode and every glyph in mono. | Type: AsciiColor | Default "orange" |
| ink The smoke, the cooler glyphs in palette mode, and what the flame's core mixes toward. | Type: AsciiColor | Default "--ascii-ink" |
| paper The surface behind the glyphs. Smoke fades toward it. | Type: AsciiColor | Default "--ascii-paper" |
| charset Which glyphs draw the tones. See Charsets. | Type: CharsetName | Default "standard" |
| chars A custom ramp from empty to dense, such as " .oO@". Wins over charset. | Type: string | Default – |
| colorMode How glyphs are coloured. truecolor runs from coal red through the flame colour to a pale core; palette runs paper, ink, flame by tone; mono draws every glyph in the flame colour. | Type: "mono" | "truecolor" | "ansi16" | "duotone" | "palette" | Default "truecolor" |
| phosphor In mono mode, a CRT ink and glass that replace ink and paper. | Type: "p1" | "p3" | "ibm" | "blueprint" | Default – |
| ramp In duotone mode, the colour ramp from dark to light. | Type: RampName | string[] | Default – |
| ansi In ansi16 mode, which 16-colour table. | Type: "vga" | "xterm" | Default "vga" |
| grade Brightness, contrast, gamma and saturation applied to tones before glyphs are picked. | Type: Grade | Default – |
| invert Dense glyphs for dark tones instead of bright ones. | Type: boolean | Default false |
| threshold Braille and quadrants: the tone that lights a dot. | Type: number | Default 0.5 |
| edgeThreshold Edge charset: how strong a change in tone must be to draw - / | or \. | Type: number | Default 0.22 |
| dither Ordered dithering between neighbouring glyph levels. | Type: "none" | "bayer2" | "bayer4" | "bayer8" | "blue-noise" | Default "blue-noise" for braille and quadrants, else "none" |
| background "transparent" draws the glyphs only, over your own surface. | Type: "paper" | "transparent" | Default "paper" |
| fx CRT finish: scanlines, bloom, curvature, glitch, flicker and vignette, each 0 to 1. | Type: PostFx | Default – |
| cell Height of one glyph cell in CSS pixels. | Type: number | Default 12 |
| speed How fast it moves. | Type: number | Default 1 |
| animate false stops the motion: a still frame if it starts off, the current frame if it was moving. | Type: boolean | Default true |
| fps Frame rate cap. | Type: number | Default 30 |
| stillTime The moment drawn when motion is off or reduced, in seconds. | Type: number | Default 12 |
| handle Filled with a handle that reads back the current frame, for export to text, ANSI, SVG or PNG. | Type: RefObject<AsciiHandle | null> | Default – |
| fallback Shown without WebGL and until the first frame. | Type: ReactNode | Default A soft glow in the flame colour |
| className Size and position. The background fills this box. | Type: string | Default – |
Notes
- It is decorative and hidden from assistive technology. Put real text on top of it, not inside it.
- With reduced motion turned on, it draws one still frame at
stillTimeand stops. - It does not react to the pointer.
- It pauses when scrolled out of view or when the tab is hidden, and releases its WebGL context when far offscreen. Without WebGL it shows a soft glow in the flame colour along the bottom.
speedscales all of the motion together: the flames, the smoke and the sparks.