Surface

Full-bleed container for rendering engines — canvas, WebGL, video or any visual content.

Install

npx shadcn@latest add https://substrate.georgedrury.co.uk/r/surface

Examples

import { Surface, SurfaceControls, SurfaceGrid } from "@/components/substrate/surface"

export default function SurfaceDemo() {

Theme variables

VariableTailwind classFallbackDescription
--canvasbg-canvas--backgroundSurface background
--canvas-foregroundtext-canvas-foreground--foreground-mutedSurface foreground/grid

Components

ComponentDescription
SurfaceAbsolute-positioned container with bg-canvas and overflow hidden
SurfaceControlsOverlay layer with pointer-events pass-through except on children
SurfaceGridCSS radial-gradient dot pattern sized via the size prop

Props

Surface

Extends React.ComponentProps<"div">.

SurfaceControls

PropTypeDefaultDescription
position"top-left" | "top-right" | "bottom-left" | "bottom-right""bottom-right"Which corner to anchor controls to

SurfaceGrid

PropTypeDefaultDescription
sizenumber20Grid dot spacing in pixels