Using Storybook Args to Tweak Component Props Live Without Touching Code
Learn how Storybook’s Args feature lets you edit component props live via the Controls panel, instantly see changes, and share configurations through the URL — without altering source code.
18 Jun 2026, 12:43 UTC

The problem: endless prop tweaking
When you’re building a UI component, you often need to try many combinations of props — different labels, sizes, colors, or disabled states. Editing the story file, re‑running the dev server, and refreshing the browser for each change wastes time and breaks flow.
Thesis: Storybook’s Args feature gives you a live UI for prop editing
Args let you define a set of prop values for a story. Storybook’s Controls addon reads those args and renders sliders, dropdowns, checkboxes, or text fields that map directly to your component’s props. Changing a control updates the rendered story instantly, without a page reload or code change.
How Args work under the hood
Each story can export an args object whose keys match the component’s prop names. When the Controls panel is active (enabled by default in Storybook 7+), Storybook serializes those args into the URL query string and re‑renders the story whenever the query changes.
Worked example: a Button component
Assume a simple React button:
// src/components/Button.jsx
export default function Button({ label, size = 'medium', color = '#0070f3', disabled = false }) {
const styles = {
padding: size === 'large' ? '12px 24px' : '8px 16px',
fontSize: size === 'large' ? '1rem' : '0.875rem',
backgroundColor: color,
color: '#fff',
border: 'none',
cursor: disabled ? 'not-allowed' : 'pointer',
opacity: disabled ? 0.6 : 1,
};
return {label};
}
Create a story that exports args matching those props:
// src/components/Button.story.jsx
import Button from './Button';
export default {
title: 'UI/Button',
component: Button,
};
export const Primary = {
args: {
label: 'Click me',
size: 'medium',
color: '#0070f3',
disabled: false,
},
};
Run Storybook locally:
# In your project root (requires Node ≥ 14 and npm/yarn)
npm install # if dependencies are not already present
npm run storybook # or: yarn storybook
When the story loads, you’ll see a Controls panel on the right. Try the following:
- Edit the
labeltext field – the button label updates instantly. - Change the
sizedropdown betweensmall,medium,large– padding and font size adjust. - Pick a new
colorvia the color picker – background changes. - Toggle the
disabledcheckbox – the button greys out and cursor changes.
After each change, glance at the browser’s address bar. You’ll notice a query string like:
?args=label:Click%20me;size:large;color:%23ff0000;disabled:false
That string encodes the current args. Copying and sharing that URL with a teammate will open Storybook with the exact same button configuration, making it easy to reproduce a UI state or a bug.
Trade‑offs and limitations
While Args are powerful, keep these points in mind:
- Performance with complex types: If you define args for deep objects or functions, the Controls panel may become sluggish or fail to render a sensible UI control. Keep args to primitive types (string, number, boolean) or simple enumerations.
- No source mutation: Changes made via Controls affect only the Storybook runtime. To persist a new prop value in production, you must manually update the component’s usage or default props in your codebase.
- Framework‑agnostic but addon‑dependent: The feature works for React, Vue, Angular, Svelte, and plain HTML because it operates on the rendered output. However, you need the
@storybook/addon-controlspackage installed and configured in yourmain.js.
Practical way to verify your setup
- Start Storybook (
npm run storybook). - Open a story that exports
args. - Interact with at least one control.
- Confirm the UI updates without a full page reload.
- Check the URL for updated
args=…query parameters. - Copy the URL, open it in a new tab or share it; the same configuration should appear.
Actionable closing
If you find yourself constantly editing story files to test prop variations, give Args a try. Start with a small component, export a simple args object, and let the Controls panel do the heavy lifting. Remember to keep args simple for responsiveness, and treat the UI as a scratchpad — any values you like must be copied back to your code. This tight loop between design exploration and implementation can shave minutes off each tweak and keep your team aligned on the exact UI state you’re discussing.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.