This project uses Storybook to document and showcase our React UI components. Storybook provides an isolated environment for developing components and a comprehensive documentation site.
# Install dependencies
bun install
# Start Storybook development server
bun run storybook
Visit http://localhost:6006 to view Storybook locally.
# Build static Storybook for production
bun run build-storybook
Our Storybook includes comprehensive documentation and examples for:
Storybook is automatically deployed to GitHub Pages when code is pushed to the main branch via GitHub Actions.
Live Storybook: https://brackeyscommunity.github.io/brackeys.community/
You can also trigger deployment manually:
main branch and click “Run workflow”Navigate to your repository settings:
The workflow requires these permissions (already configured):
contents: read - To checkout the codepages: write - To deploy to GitHub Pagesid-token: write - For secure deploymentTo ensure only tested code gets deployed:
main branchChromatic is a visual testing tool that captures snapshots of your Storybook components and detects visual changes. It’s integrated with our CI/CD pipeline to automatically test UI changes on every push.
Live Chromatic Storybook: Check your build status at chromatic.com
Chromatic runs automatically on every push to any branch via GitHub Actions. It:
CHROMATIC_PROJECT_TOKEN# Run Chromatic with pre-built Storybook
bun run chromatic
# Or build and run in one command
bunx chromatic --project-token=<your-token>
The Chromatic workflow (.github/workflows/chromatic.yml) is configured to:
Build fails with “JavaScript failed to load”:
.storybook/main.ts doesn’t set a base URL for Chromatic buildsGITHUB_PAGES environment variable for conditional base URL setting“Context access might be invalid” error:
CHROMATIC_PROJECT_TOKEN secret is not configured in GitHubsrc/components/ui/src/stories/// Basic story structure
export const Basic: Story = {
  render: () => {
    const [value, setValue] = useState('');
    return <YourComponent value={value} onChange={setValue} />;
  },
};
parameters.docs.description for contextThe Storybook theme is configured in:
.storybook/preview.ts - Story canvas and docs theme.storybook/manager.ts - Navigation and UI theme (if needed).storybook/
├── main.ts          # Storybook configuration
├── preview.ts       # Global decorators and parameters
└── manager.ts       # Manager UI theme (if exists)
src/stories/
├── Overview.stories.tsx    # Design system overview
├── Button.stories.tsx      # Button component examples
├── Input.stories.tsx       # Input component examples
├── Loading.stories.tsx     # Loading component examples
├── Modal.stories.tsx       # Modal component examples
└── Toast.stories.tsx       # Toast component examples
.github/workflows/
└── deploy-storybook.yml    # GitHub Actions deployment
The base URL is automatically configured for GitHub Pages deployment:
//brackeys-web/Storybook builds to storybook-static/ directory, which is deployed to GitHub Pages.
Build Fails:
bun installbun run lintDeployment Fails:
Stories Not Interactive:
render: with React stateargs: {} for stories with custom render functionssrc/components/ui/After deployment, consider:
Happy Documenting! 🎉