Turn a list into a picker.
Any shape you want.

A framework-agnostic library for building pickers: date wheels, color swatches, photo carousels, anything where someone drags through options and lands on one. You pick the shape, from a straight line to an arc, a wheel, or a layout you write yourself.

Zero dependencies · MIT

$ npm install loopem
import { createPicker } from 'loopem'

const picker = createPicker(document.getElementById('sizes'), {
  items: ['XS', 'S', 'M', 'L', 'XL'],
  layout: 'arc',
  renderItem: (size) => {
    const button = document.createElement('button')
    button.textContent = size
    return button
  },
})

picker.on('select', ({ item }) => {
  console.log('Picked size', item)
})

Works with any framework. React, Vue and Svelte also get an adapter, so it feels native there.

01Shape

One list. Every shape.

The same twenty items, the same event handlers, the same value coming back. Only the layout changed.

Read about layouts →
Drag it, flick it, scroll over it, or focus it and use the arrow keys. View the code →
02 Commerce

A color picker that updates the page.

Pick a color, the product updates. The picker only tells you which item is live. What happens next is yours.

View the code →
layout: 'arc'
Drag the swatches, or click one.
03 Booking

A date picker from three wheels.

The same component three times, on a vertical axis. Each column keeps its own focus and its own value.

View the code →
preset: wheel
Flick a column, or focus one and use the arrow keys.
04 Scale

500 photos, about a dozen in the DOM.

Loopem only renders the ones you can actually see, so a list of five hundred photos costs about what a list of ten does. The full image loads once the track settles, never on the ones flying past.

View the code →
500 photos
Flick it hard. The big image waits until you stop.
05 Checkout

A card stack you flick through.

The deck waits below and behind, each card showing the strip that identifies it.

View the code →
preset: stack
Drag the wallet, or click a card behind the front one.
06 Choosing

Paint chips, fanned out.

Every card turns about a single point below the deck. Spreading the fan preset is the whole setup.

View the code →
preset: fan
Drag the deck, or click a chip.
07 Depth

Or write the layout yourself.

A layout is just a function from distance-to-center to a position. The Cover Flow layout is fourteen lines, and it ships as a preset.

View the code →
preset: coverflow
08 Scroll-driven

The page scroll drives it.

Page scroll can own the track instead of a finger. linkToScroll wires it up and turns input off, since one offset can only have one driver.

View the code →
linkToScroll()
This one takes no input of its own. The page drives it.