src/main.tsx
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App'
import './styles.css'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
Online shadcn/ui playground with editable React and TypeScript component files, Tailwind CSS v4, real imports, and instant live preview.
Choose a source file from the explorer and edit it with Monaco.
Edit package.json to add browser-compatible npm packages or change versions. Preview packages load from esm.sh. Successful previews save resolved versions for ranges and tags with your draft and shares; change the range to resolve again. Scripts and build plugins run only in downloaded projects.
Auto-run updates the browser preview as you type. Turn it off to run your changes manually.
Use the console for browser logs and errors, or evaluate a command against the preview.
Share creates a snapshot link. Download exports the source so you can continue locally.
import { StrictMode } from 'react'
import { createRoot } from 'react-dom/client'
import App from './App'
import './styles.css'
createRoot(document.getElementById('root')!).render(
<StrictMode>
<App />
</StrictMode>,
)
import { useState } from 'react'
import { InfoIcon } from 'lucide-react'
import { Badge } from '@/components/ui/badge'
import { Button } from '@/components/ui/button'
import {
Card,
CardContent,
CardDescription,
CardFooter,
CardHeader,
CardTitle,
} from '@/components/ui/card'
import {
Dialog,
DialogContent,
DialogDescription,
DialogFooter,
DialogHeader,
DialogTitle,
DialogTrigger,
} from '@/components/ui/dialog'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import {
Select,
SelectContent,
SelectItem,
SelectTrigger,
SelectValue,
} from '@/components/ui/select'
import { Switch } from '@/components/ui/switch'
import {
Tooltip,
TooltipContent,
TooltipProvider,
TooltipTrigger,
} from '@/components/ui/tooltip'
export default function App() {
const [email, setEmail] = useState('')
const [plan, setPlan] = useState('starter')
const [teamWorkspace, setTeamWorkspace] = useState(true)
return (
<TooltipProvider>
<main className="flex min-h-screen items-center justify-center bg-muted/40 p-6">
<Card className="w-full max-w-md shadow-xl shadow-black/5">
<CardHeader>
<div className="flex items-center justify-between gap-3">
<div className="flex size-10 items-center justify-center rounded-lg bg-primary text-primary-foreground">
ui
</div>
<Badge variant="secondary">20 components ready</Badge>
</div>
<CardTitle className="pt-2">Create your workspace</CardTitle>
<CardDescription>
A real shadcn starter with editable component source.
</CardDescription>
</CardHeader>
<CardContent className="space-y-5">
<div className="space-y-2">
<Label htmlFor="email">Work email</Label>
<Input
id="email"
type="email"
value={email}
placeholder="[email protected]"
onChange={(event) => setEmail(event.currentTarget.value)}
/>
</div>
<div className="space-y-2">
<Label htmlFor="plan">Plan</Label>
<Select value={plan} onValueChange={setPlan}>
<SelectTrigger id="plan" className="w-full">
<SelectValue placeholder="Choose a plan" />
</SelectTrigger>
<SelectContent>
<SelectItem value="starter">Starter</SelectItem>
<SelectItem value="pro">Pro</SelectItem>
<SelectItem value="enterprise">Enterprise</SelectItem>
</SelectContent>
</Select>
</div>
<div className="flex items-center justify-between rounded-lg border p-3">
<div className="space-y-1">
<Label htmlFor="team-workspace">Team workspace</Label>
<p className="text-sm text-muted-foreground">
Let teammates join this project.
</p>
</div>
<Switch
id="team-workspace"
checked={teamWorkspace}
onCheckedChange={setTeamWorkspace}
/>
</div>
</CardContent>
<CardFooter className="justify-end gap-2">
<Tooltip>
<TooltipTrigger asChild>
<Button variant="outline" size="icon" aria-label="About this starter">
<InfoIcon />
</Button>
</TooltipTrigger>
<TooltipContent>Every component is editable.</TooltipContent>
</Tooltip>
<Dialog>
<DialogTrigger asChild>
<Button>Create workspace</Button>
</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Workspace ready</DialogTitle>
<DialogDescription>
{email || 'Your account'} is using the {plan} plan.
</DialogDescription>
</DialogHeader>
<div className="rounded-lg bg-muted p-4 text-sm">
Team access is {teamWorkspace ? 'enabled' : 'disabled'}.
</div>
<DialogFooter showCloseButton />
</DialogContent>
</Dialog>
</CardFooter>
</Card>
</main>
</TooltipProvider>
)
}
The editor uses Monaco, the engine behind VS Code, with language-aware editing tools and familiar keyboard controls.
Edit a source file from the project explorer — the live preview recompiles automatically.
Add, rename, duplicate or delete project files as needed. Update affected imports after renaming or moving a file.
Use the console for logs and errors, and Format to tidy the active file.
Share the complete project or download a Vite project ZIP with its source files and package.json.
20 Official Components
Editable Component Source
React 19 + TypeScript
Tailwind CSS v4
Local File Imports
Live Preview
CSS-first Theme
Auto-run updates the preview as you type. Turn it off to run manually with Run or Ctrl/⌘ + Enter.
The Console prompt can inspect browser globals and the rendered DOM, but not variables scoped inside ES modules or component state.
Console shortcuts apply when its prompt is focused. Editor shortcuts apply inside the code editor.
Code runs in a sandboxed browser preview, without Node.js, a backend, or private environment variables.
Download the project when you need build plugins, server APIs, native modules, or a production dependency workflow.