Skip to content

Layout Scrub

A list/grid view switch. Dragging the thumb morphs items continuously between list rows and grid cells with constant text block width, proportional 16:10 thumbnail scaling, and smoothstep interpolation.

Dependencies

motionclsxtailwind-merge

Interaction

Continuous geometric layout switcher. Items interpolate linearly between list and grid coordinates driven by a normalized parameter t. Smoothstep drag scrubbing and springless tween settling with zero overshoot.

Props

PropTypeDescription
itemsLayoutScrubItem[]Array of 2 to 24 items with id, thumbnail, title, optional meta, and optional trailing text.
headingstringOptional heading text displayed above the item list.
captionstringOptional secondary caption text displayed below the heading.
columns2 | 3 | 4Number of grid columns in grid view.
view"list" | "grid"Controlled active view mode.
defaultView"list" | "grid"Initial view mode when uncontrolled.
onViewChange(view: "list" | "grid") => voidCallback fired when the active view changes.
classNamestringOptional CSS classes merged with the root container.

MIT License. Free to use in personal and commercial projects. Built for Peel UI.