Skip to main content

Component Library Guide

The FindU web app uses a combination of custom components and the shadcn/ui component library built on Radix UI primitives.

Component Organization

Base UI Components (/components/ui/)

These are foundational components from shadcn/ui:

Custom Components

App-specific components that compose the base UI:

Using shadcn/ui Components

Button Example

Card Layouts

Form Controls

Custom Component Patterns

Page Header Component

Standard header for all pages:

Data Display Components

Stats Card

Engagement Chart

Loading States

Composing Complex UI

Data Table with Filters

Component Best Practices

Accessibility

  • All interactive elements have proper ARIA labels
  • Keyboard navigation support
  • Focus management in modals
  • Color contrast compliance

Responsive Design

Performance

  • Use React.memo for expensive components
  • Virtualize long lists with @tanstack/react-virtual
  • Lazy load heavy components
  • Optimize re-renders with proper key props

Styling Components

Using Tailwind Classes

Theme Variables

The app uses CSS variables for theming:
  • --background: Page background
  • --foreground: Primary text
  • --muted: Secondary elements
  • --primary: Brand color
  • --destructive: Error states

Component Documentation

Props Documentation

Usage Examples

Each component should have:
  1. Basic usage example
  2. Common variations
  3. Props documentation
  4. Accessibility notes

Testing Components

Component Testing

Storybook (if implemented)

Next Steps