# Fakemui Getting Started Guide Fakemui is a Material Design 3-compliant UI component library providing 122+ components for consistent design across MetaBuilder frontends (React/Next.js and Qt6/QML). ## Quick Setup ### Installation Fakemui is available within the MetaBuilder monorepo. Import directly: ```typescript import { Button, Card, TextField, Box } from '@/fakemui' ``` ### Basic Component Usage ```typescript import { Button, Card, Box, Typography } from '@/fakemui' export function MyComponent() { return ( Hello, Fakemui! ) } ``` ## Common Components by Category ### Forms & Inputs ```typescript import { Button, TextField, Select, Checkbox, RadioButton, Switch, DatePicker, FileUpload } from '@/fakemui' // Text input // Select dropdown setTheme(value)} /> ) } ``` ## Common Patterns ### Form Handling ```typescript import { Button, TextField, Box, Alert } from '@/fakemui' import { useState } from 'react' export function MyForm() { const [formData, setFormData] = useState({ name: '', email: '' }) const [error, setError] = useState('') const handleSubmit = async (e) => { e.preventDefault() if (!formData.email) { setError('Email is required') return } // Submit logic } return ( {error && {error}} setFormData({ ...formData, name: e.target.value })} fullWidth margin="normal" /> setFormData({ ...formData, email: e.target.value })} fullWidth margin="normal" /> ) } ``` ### Data Table with Actions ```typescript import { Table, IconButton, Menu, MenuItem } from '@/fakemui' import { useState } from 'react' export function DataTable({ data }) { const [anchorEl, setAnchorEl] = useState(null) const [selectedRow, setSelectedRow] = useState(null) const columns = [ { field: 'id', headerName: 'ID', width: 70 }, { field: 'name', headerName: 'Name', flex: 1 }, { field: 'actions', headerName: 'Actions', sortable: false, renderCell: (params) => ( <> { setAnchorEl(e.currentTarget) setSelectedRow(params.row.id) }}> ⋮ setAnchorEl(null)}> Edit Delete ) } ] return } ``` ### Modal Dialog ```typescript import { Dialog, DialogTitle, DialogContent, DialogActions, Button } from '@/fakemui' import { useState } from 'react' export function ConfirmDialog() { const [open, setOpen] = useState(false) return ( <> setOpen(false)}> Confirm Deletion This action cannot be undone. Are you sure? ) } ``` ## Styling with sx Prop The `sx` prop provides Material Design 3-aware styling using theme values: ```typescript Responsive content ``` ## Responsive Design Fakemui uses Material Design 3 breakpoints: ```typescript import { useMediaQuery } from '@/fakemui/hooks' export function ResponsiveComponent() { const isMobile = useMediaQuery('(max-width: 600px)') return isMobile ? : } ``` Or use Grid system: ```typescript Takes full width on mobile, half on tablet, third on desktop ``` ## Best Practices 1. **Use component composition** - Build complex UIs from simple components 2. **Leverage theming** - Use theme colors instead of hardcoding colors 3. **Follow accessibility** - Use semantic HTML and ARIA attributes 4. **Responsive first** - Design for mobile, enhance for larger screens 5. **Avoid sx prop abuse** - Use components and theme values when possible 6. **Type your props** - Use TypeScript for better IDE support 7. **Test interactions** - Use role-based selectors for testing ## Next Steps - Explore [COMPONENT_API_REFERENCE.md](./COMPONENT_API_REFERENCE.md) for detailed component APIs - Read [THEMING_GUIDE.md](./THEMING_GUIDE.md) for custom theme creation - Check [ARCHITECTURE.md](./ARCHITECTURE.md) for design decisions and patterns - See [MIGRATION_GUIDE.md](./MIGRATION_GUIDE.md) for migrating from other UI libraries ## Resources - [Material Design 3 Spec](https://m3.material.io/) - Fakemui Component Index: `/fakemui/index.ts` - React Components: `/fakemui/` directory - QML Components: `/fakemui/qml/components/` directory