Overview
OdontologyApp includes a comprehensive component library built with Svelte 5, utilizing modern reactive patterns with$state, $derived, and $bindable. Components are organized by purpose and reusability.
Component Organization
UI Components
Button
Flexible button component with multiple variants and sizes. Location:src/lib/components/ui/Button.svelte (src/lib/components/ui/Button.svelte:1-112)
Props:
primary: Teal background, white textoutline: Transparent with borderdanger: Red background for destructive actionsghost: Transparent, minimal stylingicon: Square button for iconsicon-danger: Icon button with red styling
Modal
Generic modal/dialog component. Location:src/lib/components/ui/Modal.svelte
Props:
DataTable
Powerful data table with pagination, sorting, and custom rendering. Location:src/lib/components/ui/DataTable.svelte (src/lib/components/ui/DataTable.svelte:1-50)
Props:
- Pagination (10, 25, 50, 75, 100 records per page)
- Auto-reset to page 1 on data change
- Loading skeleton
- Empty state
- Responsive design
EmptyState
Fallback component when no data is available. Location:src/lib/components/ui/EmptyState.svelte
Usage:
Input Components
All input components share a consistent API and styling.Common Props
TextInput
Generic text input field. Location:src/lib/components/inputs/TextInput.svelte (src/lib/components/inputs/TextInput.svelte:1-167)
Additional Props:
- Teal left border accent
- Icon support with proper spacing
- Focus state with shadow and background
- Error state with red border
- Disabled state with gray background
DateInput
Date picker input. Location:src/lib/components/inputs/DateInput.svelte
Usage:
SelectInput
Dropdown select input. Location:src/lib/components/inputs/SelectInput.svelte
Props:
EmailInput
Email input with validation. Location:src/lib/components/inputs/EmailInput.svelte
Usage:
PhoneInput
Phone number input. Location:src/lib/components/inputs/PhoneInput.svelte
Usage:
TextareaInput
Multi-line text input. Location:src/lib/components/inputs/TextareaInput.svelte
Additional Props:
PasswordInput
Password input with show/hide toggle. Location:src/lib/components/inputs/PasswordInput.svelte
Usage:
FileInput
File upload input. Location:src/lib/components/inputs/FileInput.svelte
Props:
SearchInput
Search input with live filtering. Location:src/lib/components/inputs/SearchInput.svelte
Usage:
Barrel Export
All input components are exported from a single index file: Location:src/lib/components/inputs/index.js
Dental Components
Odontogram
Interactive dental chart for marking tooth conditions. Location:src/lib/components/Odontogram.svelte (src/lib/components/Odontogram.svelte:1-50)
Props:
""- Healthy/normal"caries"- Tooth decay"restored"- Filled/restored"sealant"- Dental sealant"fracture"- Broken tooth"extracted"- Missing tooth"crown"- Crown/cap"treatment"- Under treatment"endodontics"- Root canal
ToothSVG
SVG component for rendering individual teeth with surface markers. Location:src/lib/components/Odontology/ToothSVG.svelte
Props:
PatientFinance
Budget and payment management for patients. Location:src/lib/components/Odontology/PatientFinance.svelte
Features:
- Budget creation with line items
- Payment recording
- Financial history
- Balance calculation
Layout Components
Sidebar
Main navigation sidebar. Location:src/lib/components/ui/Sidebar.svelte
Features:
- Role-based menu items
- Active route highlighting
- Collapsible sections
- Permission-based visibility
Topbar
Top navigation bar with user menu. Location:src/lib/components/ui/Topbar.svelte
Features:
- User profile display
- Notifications
- Theme toggle
- Logout button
NotificationBell
Notification center component. Location:src/lib/components/ui/NotificationBell.svelte
Features:
- Real-time notification badge
- Dropdown notification list
- Mark as read functionality
Styling Conventions
CSS Variables
Components use CSS custom properties defined inapp.css:
Component CSS
Components use scoped styles with consistent patterns:Svelte 5 Patterns
Reactive State
Snippets (Render Props)
Related Documentation
- Architecture - Component organization
- User Guide - Using components in the UI
- Customization - Styling and theming
