Lenticular Panel
ComponentsLenticular Panel
ExperimentsNew

Lenticular Panel

Two artworks. One surface. A ribbed print that changes its mind as you move across it.

React + CSS

Move across the print, or adjust the viewing angle.

Live component. Go ahead, interact.
01

Installation

Run this in your shadcn-configured React project. The component and stylesheet are added together.

TERMINAL
npx shadcn@latest add http://localhost:5173/r/lenticular-panel.json

This command uses the current site address. For localhost, keep this preview running on the same computer. Files follow your configured components alias.

02

Usage

Import the component and make the details your own.

TypeScript
import { LenticularPanel } from '@/components/anticraft/LenticularPanel';

export function Example() {
  const face = { display: 'grid', placeItems: 'center', width: '100%', height: '100%', fontSize: 72 } as const;
  return (
    <LenticularPanel
      front={<span style={{ ...face, background: '#f08056', color: '#342b26' }}>DAY ☀</span>}
      back={<span style={{ ...face, background: '#303c9d', color: '#f5e9c8' }}>NIGHT ☾</span>}
      frontLabel="Day artwork"
      backLabel="Night artwork"
      segments={12}
    />
  );
}
03

Props

PropTypeDefaultDescription
frontReactNodeRequiredThe first decorative artwork. Fill the available width and height; avoid controls or non-unique SVG ids in either artwork.
backReactNodeRequiredThe second decorative artwork. Both faces are repeated as hidden visual slices.
frontLabelstring'First artwork'A meaningful name for the first artwork.
backLabelstring'Second artwork'A meaningful name for the second artwork.
segmentsnumber12The number of vertical slats, clamped from 4 to 24.
defaultValuenumber0The initial viewing angle from 0 (front) to 1 (back).
onValueChange(value: number) => voidundefinedReceives the viewing angle as it changes.
classNamestring''Additional classes. Set --ac-lenticular-height to size the panel.
04

Motion & accessibility

Considered by default.

A fine pointer changes the viewing angle across the artwork. A native range control and endpoint controls support touch and keyboard use. Repeated visual slices stay hidden from assistive technology. Reduced motion disables pointer tracking and switches directly between the two faces when the angle crosses the midpoint.

Use semantic content and meaningful labels in your composition. Check contrast and keyboard behavior with your own styles and content.