Quick Start: Storybook + App Integration โ
๐ Live Storybook (for stakeholders) โ
View components online (no local setup needed):
- Production: https://storybook.ourlantern.app
- Development: https://storybook.dev.ourlantern.app
For setup: See STORYBOOK_SETUP_GUIDE.md
โ Issues Fixed โ
- Vim swap files removed - "Open in editor" should now work
- Controls enabled - All component stories now have interactive controls
- Component created -
Button.jsxnow exists as a reusable component - App updated - Button component is now used in the home page
๐ฏ The Simple Answer โ
Storybook doesn't create separate components - it DOCUMENTS the same components you use in your app.
Component (Button.jsx)
โ
โโโโ imported by Story (Button.stories.jsx) โ Shows in Storybook
โ
โโโโ imported by App (App.jsx) โ Shows in your app๐ See It In Action โ
In Storybook (http://localhost:6007) โ
- Click Components โ Button โ Primary
- Use the Controls panel to change text and variant
- Click "Open canvas in new tab" or "Open in editor" (now works!)
In Your App (http://localhost:5173) โ
- Look at the home page
- See the same Button component working
- Click the buttons - they trigger alerts
In Your Code โ
- Component: src/components/Button.jsx
- Story: src/components/Button.stories.jsx
- Used in: src/App.jsx (lines 81-88)
๐ Quick Reference โ
To Create a New Component: โ
jsx
// 1. Create the component
// src/components/MyComponent.jsx
export default function MyComponent({ prop1, prop2 }) {
return <div>{prop1} - {prop2}</div>
}
// 2. Create the story
// src/components/MyComponent.stories.jsx
import MyComponent from './MyComponent'
export default {
title: 'Components/MyComponent',
component: MyComponent,
argTypes: {
prop1: { control: 'text' },
prop2: { control: 'number' }
}
}
export const Default = {
args: { prop1: 'Hello', prop2: 42 }
}
// 3. Use in your app
// src/App.jsx (or anywhere)
import MyComponent from './components/MyComponent'
<MyComponent prop1="World" prop2={100} />๐ Development Cycle โ
- Build in Storybook - Create/test component variants
- Save changes - Changes appear in BOTH Storybook and app instantly
- Use in app - Import and use wherever needed
- Iterate - Make changes, see updates everywhere
๐ ๏ธ Current Running Services โ
- Storybook: http://localhost:6007 (component development)
- App: http://localhost:5173 (your actual application)
Both are using the SAME components from src/components/.
๐ More Details โ
See STORYBOOK_WORKFLOW.md for the complete explanation.