Code
In context
Install · Free Web Component
One file, no dependencies. Drag preset, every other option included. Host it yourself so your visitors never load anything from our servers.
1. Install with one command — or download the file
2. Load it and use the element
3. React + TypeScript (optional)
The shadcn command adds a typed React wrapper for you. Using the file directly? Custom elements work in React as-is; for type checking add:
Pro · React + TypeScript Pro
One payment of $4.99, yours forever. Use it in unlimited personal and commercial projects; no resale.
- React component that takes any two nodes (images, video, live UI) with TypeScript types
- Hover-follow: the lens tracks the cursor without a press, for hero sections
- The vanilla Web Component, a demo page, README and license
Attributes & props
| Name | Type | Default | Description |
|---|---|---|---|
| before / after | node | — | Left and right sides. In HTML these are the first and second child. |
| value | 0..100 | 50 | Where the divider starts, as a share of the width given to the left side. |
| width | number (px) | 420 | Width; the height follows the ratio. |
| ratio | CSS aspect-ratio | '4 / 3' | Shape of the frame. |
| lens | number (px) | 52 | Lens diameter. |
| radius | number (px) | 18 | Corner radius. |
| before-label / after-label | string | 'Before' / 'After' | Corner labels; an empty string hides one. |
| hover Pro | boolean | false | The lens follows the cursor without a press. |
Drag anywhere on the picture, not only on the lens. Arrow keys move the divider by 2%, with Shift by 10%, and Home and End jump to the ends. Both sides are cropped to fill the frame, so use pictures of the same shape. The lens uses backdrop-filter; where that is unsupported it is a plain glass disc. It uses no WebGL.
More components
- Frost Card
- Holo Card
- Beam Border
- Spotlight Card
- Scratch Reveal
- Tide Slide
- Pearl Code
- Ink Sphere
- Stream Text
- Pearl Dial
- Nova Rating
- Pearl Check
- Pearl Input
- Glass Toast
- Pearl Select
- Glass Sheet
- Pearl Accordion
- Glass Tip
- Pearl Calendar
- Glass Nav
- Pearl Tabs
- Glass Command
- Halo Avatar
- Pearl Steps
- Pearl Skeleton
- Pearl Table
- Pearl Chip
- Pearl Empty
- Roll Counter
- Glass Marquee
- Reveal Text
- Mesh Gradient
- Silk Waves
- Dot Field
- Plasma Orb
- Voice Wave
- Plush Buddy
- Gummy Agent
- Glass Tabbar
- Glass Menu
- Pearl Pricing
- Glass Bento
- Quote Wall
- Glass Cta
- Magnet Button
- Glass Sidebar
- Pearl Pagination
- Pearl Breadcrumb
- Glass Dock
- Pearl Slider
- Pearl Segmented
- Liquid Metal Button
- Mercury Orb
- Prompt Input
- Voice Orb
- Aurora Ring
- Glass Toggle
- Firefly Button
- Pearl Button
- Pearl Loader
- Alien Face
- Prism Button
- Liquid Carousel
- Orbit Carousel
- Deck Carousel


