Skip to content
TheChatArchiveThe Chat Archive
o3-2025-04-16· OpenAIHugging Face LMArena Human Preference 140K

create a beatuful and simple webpage for login using shadcn

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with Metallama-4-maverick-03-26-experimental’s answer.
  1. User

    create a beatuful and simple webpage for login using shadcn

  2. Assistant

    Below is a minimal-yet-elegant login page that relies on
    shadcn/ui + TailwindCSS.
    Copy-paste it into a fresh Next 13/14 project (the “App Router” way) and you’ll get a fully-functioning, nice-looking login form.

    1. Quick setup (only once per project)
    # 1. Create a Next app (skip if you already have one)
    npx create-next-app@latest my-login-demo
    cd my-login-demo
    
    # 2. Install Tailwind & init it
    npm install -D tailwindcss postcss autoprefixer
    npx tailwindcss init -p
    
    # 3. Install shadcn/ui and generate the base components
    npx shadcn-ui@latest init               # choose “app router”, Typescript, Tailwind
    
    # 4. Pull the components we’ll use
    npx shadcn-ui@latest add button card input label       # feel free to add more later
    
    1. Tailwind globals (tailwind.config.js)
    /** @type {import('tailwindcss').Config} */
    module.exports = {
      darkMode: ["class"],
      content: [
        './app/**/*.{ts,tsx}',
        './components/**/*.{ts,tsx}',
      ],
      theme: { extend: {} },
      plugins: [require('tailwindcss-animate')],
    }
    
    1. Global CSS (app/globals.css) – keep it lean
    @tailwind base;
    @tailwind components;
    @tailwind utilities;
    
    /* Optional: subtle gradient background */
    body {
      @apply min-h-screen bg-gradient-to-br from-slate-50 via-white to-slate-100
             dark:from-slate-900 dark:via-slate-950 dark:to-black;
    }
    
    1. The Login Page (app/login/page.tsx)
    'use client'
    
    import * as React from 'react'
    import Link from 'next/link'
    import {
      Card,
      CardContent,
      CardHeader,
      CardTitle,
      CardFooter,
    } from '@/components/ui/card'
    import { Input } from '@/components/ui/input'
    import { Label } from '@/components/ui/label'
    import { Button } from '@/components/ui/button'
    
    export default function LoginPage() {
      // Demo handler (replace with real auth logic or next-auth action)
      function handleSubmit(e: React.FormEvent<HTMLFormElement>) {
        e.preventDefault()
        const data = Object.fromEntries(new FormData(e.currentTarget))
        console.log('👋 Submitted:', data)
        // TODO: call an API route or server action
      }
    
      return (
        <div className="flex items-center justify-center min-h-screen px-4">
          <Card className="w-full max-w-md shadow-lg">
            <CardHeader>
              <CardTitle className="text-2xl">Welcome back</CardTitle>
            </CardHeader>
    
            <CardContent>
              <form onSubmit={handleSubmit} className="grid gap-4">
                <div className="grid gap-2">
                  <Label htmlFor="email">Email</Label>
                  <Input
                    id="email"
                    name="email"
                    type="email"
                    placeholder="you@example.com"
                    required
                  />
                </div>
    
                <div className="grid gap-2">
                  <Label htmlFor="password">Password</Label>
                  <Input
                    id="password"
                    name="password"
                    type="password"
                    required
                  />
                </div>
    
                <Button type="submit" className="w-full">
                  Log in
                </Button>
              </form>
            </CardContent>
    
            <CardFooter className="flex flex-col gap-2">
              <p className="text-xs text-muted-foreground">
                By continuing, you agree to our <Link href="#" className="underline">Terms & Conditions</Link>.
              </p>
              <p className="text-sm">
                New here?{' '}
                <Link href="/register" className="underline font-medium">
                  Create an account
                </Link>
              </p>
            </CardFooter>
          </Card>
        </div>
      )
    }
    
    1. Optional polish

    • Dark mode works automatically (shadcn/ui + dark: variants).
    👉 Wrap your root layout with <ThemeProvider> (shadcn’s components/theme-provider.tsx) if you want a theme toggle.

    • Validation / errors: import <Form, <FormField> components from shadcn-ui if you need Zod-powered validation.

    • Social logins: add extra <Button variant="outline" className="gap-2"> with an icon.

    That’s it—open http://localhost:3000/login and enjoy your crisp, accessible login page! 🪄

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.