Component packs › Aisle › Stock Meter

Stock Meter

The stock stands on a wooden shelf; add one to the bag and it lifts off and arcs into the bag as the gap closes.

Stock Meter is a stock from Aisle, a component pack with 6 product page components: Product page controls where the product itself changes with every choice. Price: $2 for the whole pack.

Built with: shelf of items, arc into the bag, meter role.

Code: React and Next.js (TypeScript), Vue 3, plain HTML/CSS/JS, Tailwind CSS v4 and Motion (motion.dev). No npm packages needed. Keyboard accessible, with a reduced-motion version, in dark and light.

Stock Meter props

PropTypeDefaultDescription
stocknumber5Items left. Default 5.
capacitynumber8Shelf capacity, up to 8. Default 8.
lownumber5"Only N left" at or below this. Default 5.
glazenumberGlaze, 0 to 4 (0 follows the pack colour).
onAdd(left: number, inBag: number) => void
autoplaynumber | falseShowcase mode: adds one to the bag (and restocks when empty) every N ms while visible.

Methods on the ref

Use it in React

import StockMeter from './StockMeter';

<StockMeter />

The Vue, HTML, Next.js, Tailwind and Motion versions take the same options.

More in Aisle

Good for: Skeuomorphic UI.