UI Preview Guide
Lists six ways to preview UI components locally, including a dedicated mock-data preview page and optional Storybook setup.
What this file does
Lists six ways to preview UI components locally, including a dedicated mock-data preview page and optional Storybook setup.
When to use it
- You need to see UI components without a backend or database
- You want to test responsive layouts on mobile devices
- You are setting up a new project and want to verify component rendering
- You prefer a production build preview before deployment
Assumes this stack
UI Preview Guide
This guide explains different ways to preview the UI components before deploying your application.
1. Local Development Server
The simplest way to preview your UI is to run the development server:
npm run dev
This will start a local development server (typically at http://localhost:5173) with hot module reloading.
2. Dedicated Preview Page
We've created a dedicated preview page that showcases all the UI components with mock data:
-
Start the development server:
npm run dev -
Navigate to:
http://localhost:5173/preview
This page includes:
- Community Showcase component
- Notification system
- Personalized Entry Points
- Call-to-Action variants
- Signup Form
- Engagement metrics
All components on this page use mock data, so you don't need a database connection to preview them.
3. Production Build Preview
To see how your UI will look in production:
npm run build
npm run preview
This builds the application for production and serves it locally.
4. Component-Specific Preview
For individual components, you can:
- Navigate to the preview page
- Use the tabs to select specific component categories
- View different variants and states of each component
5. Mobile Preview
To preview how your UI looks on mobile devices:
- Run the development server
- Open your browser's developer tools (F12 or right-click > Inspect)
- Enable device emulation (usually an icon that looks like a phone/tablet)
- Select different device sizes to see how your UI adapts
6. Setting Up Storybook (Optional)
For more advanced component development and testing, you can set up Storybook:
See the setup-storybook.md file for detailed instructions.
Environment Variables for Preview
The preview page works without any environment variables, as it uses mock data. However, if you want to connect to your actual data sources:
-
Create a
.env.localfile with your API keys:VITE_SUPABASE_URL=your_supabase_url VITE_SUPABASE_ANON_KEY=your_supabase_anon_key VITE_AIRTABLE_API_KEY=your_airtable_api_key VITE_AIRTABLE_BASE_ID=your_airtable_base_id -
Restart your development server
Troubleshooting Preview Issues
If you encounter issues with the preview:
- Components not rendering: Check the console for errors
- Styling issues: Make sure Tailwind is properly configured
- Mock data not appearing: Verify that the mock data is correctly defined in the Preview component
- Authentication errors: The preview page doesn't require authentication, but if you're testing authenticated features, you may need to log in first
What's inside
6 preview methods, 4 troubleshooting tips, 3 code blocks, 1 environment variables section
Change this for your project
- Replace
VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY,VITE_AIRTABLE_API_KEY, andVITE_AIRTABLE_BASE_IDwith your own environment variables - Replace the preview page path
/previewif your route differs - Replace the reference to
setup-storybook.mdwith your own Storybook setup instructions
Where it goes
Keep it in your repository where the agent or team that needs it will read it.
Worth borrowing
- Providing a dedicated preview page with mock data so developers can test components without a database
- Offering multiple preview methods (dev server, production build, mobile emulation) to cover different testing needs
Related Documents
Incident Response Runbooks - Deal Scout
Defines step-by-step procedures for 9 incident types plus a rollback and escalation policy for a Docker-based deal-scraping service.
Document Preview & Download Feature - Complete Guide
Adds document preview and download endpoints that retrieve files from MinIO and serve them through the application with caching and security.
On-Call Policy
Defines a weekly on-call rotation, escalation matrix, paging procedures, and shift handoff process for engineering teams.
SRO-001 On-Call & Incident Response
Defines a complete on-call schedule, incident severity levels, response procedures, and post-incident analysis workflow for SRE teams.