HeroUI Integration Guide
This document outlines the integration of HeroUI into the Kai application. HeroUI is being used for both frontend and backend UI components to provide a consistent design system across the application.
Overview
HeroUI has been integrated into the project to standardize the UI components and provide a consistent look and feel. The integration is set up to:
- Allow gradual adoption (existing components will be updated later)
- Ensure new components use HeroUI from the start
- Maintain a consistent theme across the application
Files and Structure
The HeroUI integration consists of the following files:
src/theme/heroui-theme.ts
- Contains the HeroUI theme configurationsrc/providers/HeroUIProvider.tsx
- Provider component that wraps the application with HeroUI themegatsby-browser.js
andgatsby-ssr.js
- Wrap the application with the HeroUIProvidersrc/components/examples/HeroUIExample.tsx
- Example component showcasing HeroUI usage
Usage Guidelines
For New Components
All new components should use HeroUI components and styling. Here's a basic example:
import React from 'react';
import from '@heroui/react';
const MyNewComponent: React.FC = () => {
return (
<Card>
<h2>My New Component</h2>
<TextField label="Example Input" />
<Button variant="contained">Submit</Button>
</Card>
);
};
export default MyNewComponent;
Theme Access
You can access the HeroUI theme in your components:
import React from 'react';
import from '@heroui/react';
const MyComponent: React.FC = () => {
const theme = useTheme();
return (
<div style={% raw %}}>
Themed content
</div>
);
};
Common Components
Here are some commonly used HeroUI components:
Button
- For actions and triggersCard
- For containing related contentTextField
- For text inputSelect
- For dropdown selectionAlert
- For notifications and messagesModal
- For dialogs and popupsTable
- For tabular data
Existing Components
Existing components will continue to use their current styling (Material-UI or styled-components) until they are updated to use HeroUI. Do not modify existing component styling unless specifically tasked with updating them to use HeroUI.
Backend Integration
For backend admin interfaces, HeroUI is also available via the @heroui/node
package. Backend templates should follow the same design system for consistency.
Best Practices
- Consistency: Follow the HeroUI component patterns for consistent user experience
- Theme Variables: Use theme variables instead of hardcoded values for colors, spacing, etc.
- Responsive Design: Ensure components work across different screen sizes
- Accessibility: Maintain accessibility standards when using HeroUI components
Reference Example
See src/components/examples/HeroUIExample.tsx
for a reference implementation showing how HeroUI components and styling should be used.
Resources
- HeroUI Documentation - Official documentation for HeroUI components and API
- Theme Customization - How to customize the HeroUI theme