Glass Code Block
A premium frosted-glass code editor window with a regex tokenizer and line-by-line stagger reveal
$ pnpm dlx shadcn@latest add @remocn/glass-code-blockUsage
// src/Root.tsx
import { Composition } from "remotion";
import { GlassCodeBlock } from "@/components/remocn/glass-code-block";
const GlassCodeBlockScene = () => (
<GlassCodeBlock
title="hero.tsx"
code={`export function Hero() {\n return <h1>Hello</h1>;\n}`}
/>
);
export const RemotionRoot = () => (
<Composition
id="GlassCodeBlock"
component={GlassCodeBlockScene}
durationInFrames={180}
fps={30}
width={1280}
height={720}
/>
);With Backdrop
Renders transparent — supply the background via Backdrop:
import { Backdrop } from "@/components/remocn/backdrop";
import { GlassCodeBlock } from "@/components/remocn/glass-code-block";
<Backdrop fill={{ type: "color", value: "#0a0a0a" }}>
<GlassCodeBlock title="hero.tsx" code={`export function Hero() {\n return <h1>Hello</h1>;\n}`} />
</Backdrop>Props11
| Prop | Type | Default |
|---|---|---|
| code | string— Source code to render. Newlines split into lines. | |
| title | string"hero.tsx" Filename shown in the chrome bar | |
| width | number760 Window width in pixels | |
| height | number460 Window height in pixels | |
| fontSize | number16 Code font size in pixels | |
| glassColor | string"rgba(10, 10, 10, 0.6)" Card surface color. Keep alpha < 1 for glass refraction. | |
| staggerFrames | number4 Frames between each line's reveal | |
| showTrafficLights | booleantrue Show the dimmed macOS-style window controls | |
| aura | booleanfalse Render an animated glow blob behind the glass. Leave off and supply a Backdrop image for the glass to refract. | |
| speed | number1 Playback speed multiplier | |
| className | string— Optional className passed to the root container | |
- codestring
Source code to render. Newlines split into lines.
- titlestring
Filename shown in the chrome bar
Default
"hero.tsx" - widthnumber
Window width in pixels
Default
760 - heightnumber
Window height in pixels
Default
460 - fontSizenumber
Code font size in pixels
Default
16 - glassColorstring
Card surface color. Keep alpha < 1 for glass refraction.
Default
"rgba(10, 10, 10, 0.6)" - staggerFramesnumber
Frames between each line's reveal
Default
4 - showTrafficLightsboolean
Show the dimmed macOS-style window controls
Default
true - auraboolean
Render an animated glow blob behind the glass. Leave off and supply a Backdrop image for the glass to refract.
Default
false - speednumber
Playback speed multiplier
Default
1 - classNamestring
Optional className passed to the root container