Get Started
Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Card
- Checkbox
- Collapsible
- Combobox
- Context Menu
- Date Picker (Lite)
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP (Lite)
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
Create a project
Start with a Hono project, or use your own:
pnpm create hono@latest my-appnpm create hono@latest my-appyarn create hono@latest my-appbun create hono@latest my-appMake sure tsconfig.json uses Hono JSX:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "hono/jsx",
"paths": { "@/*": ["./*"] }
}
}Add Tailwind CSS
pnpm add tailwindcss @tailwindcss/clinpm install tailwindcss @tailwindcss/cliyarn add tailwindcss @tailwindcss/clibun add tailwindcss @tailwindcss/cliRun the CLI
Set up the theme with your preset:
pnpm dlx shadcnui-hono-jsx@latest init --preset b0npx shadcnui-hono-jsx@latest init --preset b0yarn dlx shadcnui-hono-jsx@latest init --preset b0bunx shadcnui-hono-jsx@latest init --preset b0Import the theme
Import the theme after Tailwind CSS, and let Tailwind scan the components:
@import "tailwindcss";
@import "../styles/shadcn/theme.css";
@source "../components/ui";Build the stylesheet into public/:
pnpm dlx @tailwindcss/cli -i src/style.css -o public/style.css --watchnpx @tailwindcss/cli -i src/style.css -o public/style.css --watchyarn dlx @tailwindcss/cli -i src/style.css -o public/style.css --watchbunx @tailwindcss/cli -i src/style.css -o public/style.css --watchAdd components
pnpm dlx shadcnui-hono-jsx@latest add button cardnpx shadcnui-hono-jsx@latest add button cardyarn dlx shadcnui-hono-jsx@latest add button cardbunx shadcnui-hono-jsx@latest add button cardUse them
import { Hono } from "hono"
import { serveStatic } from "hono/bun"
import { Button } from "@/components/ui/button"
import {
Card,
CardContent,
CardFooter,
CardHeader,
CardTitle,
} from "@/components/ui/card"
const app = new Hono()
// Serves /style.css and the client scripts in public/shadcn/.
app.use("/*", serveStatic({ root: "./public" }))
app.get("/", (c) =>
c.html(
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="stylesheet" href="/style.css" />
</head>
<body>
<Card class="max-w-sm">
<CardHeader>
<CardTitle>Account</CardTitle>
</CardHeader>
<CardContent>Your account settings.</CardContent>
<CardFooter>
<Button type="submit">Save</Button>
</CardFooter>
</Card>
</body>
</html>
)
)
export default appOn Node.js, import serveStatic from @hono/node-server/serve-static. On Cloudflare Workers, serve public/ as static assets ("assets": { "directory": "./public" } in wrangler.jsonc).
Components that need a client script list it on their page; see Client Scripts.