Hi everyone π
I built a new addon for Storybook called Range Controls.
It lets you adjust story args (strings, numbers, and arrays) with sliders β making it easier to stress-test layouts and catch edge cases.
π Motivation
I often used Storybookβs built-in argTypes
with type: "range"
sliders to check design variations.
That works great for primitives (strings, numbers), but for more complex structures β like arrays of nested objects (e.g. tags inside a card) β I found myself writing the same boilerplate code again and again.
This addon was created to reduce that overhead and make it simpler to configure sliders for strings, numbers, and arrays.
π¨ Demo
Card List | Range Controls Panel |
---|---|
π Live Demo: Chromatic preview
π¦ Installation
npm install --save-dev storybook-addon-range-controls
.storybook/main.js
addons: [
"@storybook/addon-docs",
"storybook-addon-range-controls",
];
β‘ Usage Example
parameters: {
range: {
title: { type: "string", min: 0, max: 50, step: 5 },
likes: { type: "number", min: 0, max: 999 },
tags: {
type: "array",
min: 0,
max: 5,
items: { type: "string" },
defaultItem: (i: number) => `tag-${i + 1}`,
},
}
}
π Feedback
Iβd love to hear your thoughts:
- Is the API design clear enough?
- Would this be useful in your Storybook workflow?
- Any missing features youβd expect?
π Links:
Thanks for checking it out! π
Top comments (0)
Some comments may only be visible to logged-in visitors. Sign in to view all comments.