HyperSaaS
FrontendUI Components

Overview

Component library built on shadcn/ui, Radix UI, and Tailwind CSS.

HyperSaaS uses shadcn/ui as its component foundation — a collection of accessible, customizable components built on Radix UI primitives and styled with Tailwind CSS.

Component Categories

UI Primitives (components/ui/)

44+ base components from shadcn/ui:

CategoryComponents
Form & InputButton, Input, Textarea, Select, Checkbox, Switch, Label, Form, DatePicker, Calendar
NavigationSidebar, Breadcrumb, NavigationMenu, Tabs, Pagination, Menubar
OverlayDialog, AlertDialog, Sheet, Popover, DropdownMenu, HoverCard, Tooltip, Command
Data DisplayTable, Badge, Card, Avatar, Progress, Skeleton, Carousel, Chart
LayoutScrollArea, Separator, Resizable, Collapsible, Accordion, ToggleGroup
FeedbackSonner (toasts)

AI Elements (components/ai-elements/)

28 chat-specific components from the Vercel AI SDK patterns:

ComponentPurpose
message.tsxMessage container with avatar
prompt-input.tsxRich input with attachments
chain-of-thought.tsxExpandable reasoning steps
branch.tsxResponse branch navigation
suggestion.tsxClickable suggestion chip
citation-sources.tsxRAG source display
code-block.tsxSyntax-highlighted code
canvas.tsxFullscreen artifact view
loader.tsx / shimmer.tsxLoading animations

Feature Components

DirectoryPurpose
components/auth/Login, register, password reset forms
components/chat/Chat session UI, messages, settings
components/documents/Upload, viewer, table
components/knowledge-base/KB list, create, detail
components/workspaces/Workspace CRUD, members
components/teams/Team management
components/billing/Subscription management
components/marketing/Marketing page sections
components/dashboard/Dashboard layout parts
components/fragments/Small reusable pieces

Design Principles

Composition

Components compose via props and children, not inheritance:

<Card>
  <CardHeader>
    <CardTitle>Title</CardTitle>
    <CardDescription>Description</CardDescription>
  </CardHeader>
  <CardContent>
    <p>Content here</p>
  </CardContent>
</Card>

Class Merging

The cn() utility merges Tailwind classes safely:

import { cn } from "@/lib/utils";

// Merges classes, handles conflicts (last wins)
<div className={cn("px-4 py-2", isActive && "bg-primary text-primary-foreground")} />

Forms

Forms use react-hook-form with Zod validation:

const form = useForm<ChatCreateInput>({
  resolver: zodResolver(chatSessionCreateSchema),
  defaultValues: { name: "", ai_provider: "openai", ai_model: "gpt-4o" },
});

<Form {...form}>
  <FormField
    control={form.control}
    name="name"
    render={({ field }) => (
      <FormItem>
        <FormLabel>Name</FormLabel>
        <FormControl>
          <Input {...field} />
        </FormControl>
        <FormMessage />
      </FormItem>
    )}
  />
</Form>

Responsive Design

Components adapt to screen size using Tailwind breakpoints and the useIsMobile() hook:

const isMobile = useIsMobile(); // true if viewport < 768px

// Desktop: resizable panels
// Mobile: stacked layout with sheet modals
{isMobile ? <Sheet>{content}</Sheet> : <ResizablePanel>{content}</ResizablePanel>}

Adding Components

To add a new shadcn/ui component:

npx shadcn@latest add [component-name]

This generates the component in src/components/ui/ with proper Tailwind styling and Radix UI accessibility.

On this page