mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-05-01 01:05:00 +00:00
Molecules
Molecules are simple groups of atoms that function together as a cohesive unit. Built on Material UI.
Components
| Component | Description | Atoms Used |
|---|---|---|
Card |
Container with header/content/footer | Box, Typography |
Dialog |
Modal dialog with transitions | MuiDialog |
Alert |
Feedback message with severity | MuiAlert |
Tabs |
Tab navigation | MuiTabs, MuiTab |
Accordion |
Collapsible sections | MuiAccordion |
Select |
Dropdown selection | MuiSelect |
DropdownMenu |
Context/action menu | Menu, MenuItem |
FormField |
Label + input + error | Label, Input |
SearchInput |
Input with search icon | TextField |
Popover |
Floating content panel | MuiPopover |
Application Molecules
AppHeader- Application header with logo and navigationAppFooter- Application footer with linksProfileCard- User profile display cardSecurityWarningDialog- Security warning modalPasswordChangeDialog- Password change form modal
Usage
import { Card, CardHeader, CardContent, Dialog, Alert } from '@/components/molecules'
function MyPage() {
return (
<Box>
<Card>
<CardHeader title="Title" description="Subtitle" />
<CardContent>Content here</CardContent>
</Card>
<Alert variant="success" title="Success!">
Operation completed.
</Alert>
<Dialog open={isOpen} onOpenChange={setIsOpen}>
<DialogContent>Modal content</DialogContent>
</Dialog>
</Box>
)
}
Rules
- ✅ DO compose molecules from atoms
- ✅ DO keep molecules focused on a single purpose
- ✅ DO use MUI
sxprop for styling - ✅ DO support both controlled and uncontrolled modes
- ❌ DON'T import organisms
- ❌ DON'T add complex business logic
- ❌ DON'T use Tailwind classes (use MUI
sxprop)
Styling
<Card sx={{ maxWidth: 400, mx: 'auto' }}>
<CardHeader
title="User Profile"
sx={{ bgcolor: 'primary.light' }}
/>
<CardContent>
<Typography>Content with theme colors</Typography>
</CardContent>
</Card>