Side-by-Side AI Model Comparison
A model-comparison layout: one shared prompt input at the top, and two response panels below it side-by-side on larger screens, stacking on mobile. Each panel carries a model-name badge and its own independent thumbs-up/down rating control so a visitor can judge each response separately.
Docs
Installation
A real shadcn registry command, not a copy-paste stand-in: it fetches this block plus its badge, button dependencies and any missing npm packages, and installs them straight into your project.
npx shadcn add https://staaarter.com/r/side-by-side-ai-model-comparison.jsonPrefer not to use the CLI? Copy the source from the Code toggle above into src/components/blocks/chat/chat14.tsx instead.
Usage
The file also exports chat14Demo, the exact props behind the preview above. Spread it to get a working section in one line, then replace it with your own data.
import { Chat14, chat14Demo } from "@/components/blocks/chat/chat14"; export default function Page() { return <Chat14 {...chat14Demo} />; }
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| heading | string | "Compare responses" | Small heading shown in the panel header. |
| promptPlaceholder | string | "Ask both models anything..." | Placeholder text for the shared prompt input. |
| panels | ModelResponsePanel[] | none | The two (or more) model response panels rendered side-by-side. |
| className | string | none | Extra classes for the outer panel element. |
Types
export interface ModelResponsePanel { id: string; modelName: string; response: string; }
Behavior notes
- The shared prompt input and Send button are decorative: typing and clicking Send don't trigger any real dual-generation, there's no onSubmit wired up.
- Each panel's thumbs up/down control is real, independent client state: a `Record<panelId, 'up' | 'down' | null>` in useState, toggled on click via aria-pressed buttons, clicking the active rating again clears it.
- Panels are visually divided with divide-x on sm+ screens and stack with divide-y on mobile.
More Chat Blocks
View all →rich-prompt-input-with-suggestions
Rich Prompt Input with Smart Suggestions
An AI prompt composer with attachment icons, a model selector, and a grid of clickable prompt suggestion cards.
ai-streaming-response-typewriter
AI Streaming Response with Live Typing
A single AI chat exchange with a skeleton loading state, a word-by-word typewriter reveal, and a stop-generating control.
ai-response-with-cited-sources
AI Response with Cited Sources
A Perplexity-style answer with inline numbered citation markers and an expandable source list below it.
code-generation-chat-with-syntax-highlighting
Code Generation Chat with Syntax Highlighting
A developer chat message with a file-name tab bar, a language badge, illustrative syntax coloring, and a real copy button.
prompt-starter-grid
AI Prompt Starter Grid
A tabbed grid of prompt template cards, filterable by category, each with an icon, title, and description.
ai-agent-profile-card
AI Agent Profile Card
A showcase card for an AI agent with avatar, capability badges, a sample chat preview, stats, and action buttons.