DEV Community

silverbirder
silverbirder

Posted on

New Storybook Addon: Range Controls – stress-test your UI with sliders

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
storybook-addon-range-control-card-list storybook-addon-range-control-panel

πŸ‘‰ Live Demo: Chromatic preview

πŸ“¦ Installation

npm install --save-dev storybook-addon-range-controls
Enter fullscreen mode Exit fullscreen mode

.storybook/main.js

addons: [
  "@storybook/addon-docs",
  "storybook-addon-range-controls",
];
Enter fullscreen mode Exit fullscreen mode

⚑ 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}`,
    },
  }
}
Enter fullscreen mode Exit fullscreen mode

πŸ™ 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.