Documentation menu
Getting Started
Components
Primitives
- Agent Thinking
- Alert
- Alert Dialog
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Calendar
- Card
- Checkbox
- Command
- Command Palette
- Context Menu
- Data Table
- Dialog
- Dropdown Menu
- Empty
- Field
- Glow Cloud
- Input
- Label
- Medication Schedule
- Period Tabs
- Popover
- Rainbow Button
- Scroll Area
- Select
- Selectable Card
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Sonner
- Spinner
- Switch
- Table
- Tabs
- Tag
- Textarea
- Timeline
- Tooltip
- Use Count Up
Charts and metrics
Patterns
- Confirm Button
- Date Picker
- Embedded
- Empty State
- Entity Drawer
- Error Boundary
- Field Row
- File Dropzone
- Form Dialog
- Kv
- List Editor
- List Page
- Live Time
- Mini Table
- Money
- Note Field
- Note Text
- Page Card
- Page Header
- Page Tabs
- Page Toolbar
- Person Cell
- Picture Field
- Print Card
- Range Switcher
- Row Actions
- Search Input
- Search Select
- Selected Box
- Signature Pad
- Status Badge
- Sub Nav Layout
- Suggest Input
- Tab Icons
- Table Footer
- Theme Accent Picker
- Time Picker
- View All Link
Dashboard cards
Advanced
Device frames
Website widgets
Website screens
Website panels
Registry
Build your own
The exact structure of this repository, step by step.
Project layout
vcare-ui/
registry.json the manifest
src/
registry/vcare/
lib/utils.ts cn()
ui/button.tsx ... the app components (folders for data-grid, gantt…)
site/ the website kit and its sections (blocks)
styles/vcare.css the app theme; site.css the website theme
examples/*.tsx demos shown on the docs pages
scripts/gen-registry.mjs writes registry.json from the files
pages/ this documentation site
public/r/ generated by shadcn build
public/_headers CORS for Cloudflare
wrangler.jsonc Cloudflare configThe registry and the website live in one repo, and the website imports the same files it publishes. The component on the page and the component you install can never drift apart.
1. Create an Astro project
npm create astro@latest vcare-ui
cd vcare-ui
npx astro add react sitemap
npm i tailwindcss @tailwindcss/vite class-variance-authority clsx tailwind-merge @radix-ui/react-slot
npm i -D shadcn wrangler2. Add the alias
Registry source imports from @/registry/..., so alias @ to src in both TypeScript and Vite.
tsconfig.json
{
"extends": "astro/tsconfigs/strict",
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "react",
"paths": { "@/*": ["./src/*"] }
}
}astro.config.mjs
import { defineConfig } from "astro/config"
import react from "@astrojs/react"
import tailwindcss from "@tailwindcss/vite"
import path from "node:path"
export default defineConfig({
output: "static",
integrations: [react()],
vite: {
plugins: [tailwindcss()],
resolve: { alias: { "@": path.resolve("./src") } },
},
})3. Write a component
Put it under src/registry/<name>/ui/. Import the helper from the registry path, not a relative one:
import { cn } from "@/registry/vcare/lib/utils"
function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
return <div className={cn("animate-pulse rounded-md bg-accent", className)} {...props} />
}
export { Skeleton }4. Register it
registry.json
{
"$schema": "https://ui.shadcn.com/schema/registry.json",
"name": "vcare-ui",
"homepage": "https://vcare-ui.pages.dev",
"items": [
{
"name": "utils",
"type": "registry:lib",
"dependencies": ["clsx", "tailwind-merge"],
"files": [{ "path": "src/registry/vcare/lib/utils.ts", "type": "registry:lib" }]
},
{
"name": "skeleton",
"type": "registry:ui",
"title": "Skeleton",
"registryDependencies": ["@vcare/utils"],
"files": [{ "path": "src/registry/vcare/ui/skeleton.tsx", "type": "registry:ui" }]
}
]
}Cross-references
Reference your own items with the namespace form,
@vcare/utils. Consumers resolve it through their registries config, so the registry never hard-codes its own domain.
5. Build and test
Wire the build into package.json so the JSON is always fresh:
{
"scripts": {
"registry:build": "shadcn build -o public/r",
"dev": "npm run registry:build && astro dev --port 5190",
"build": "npm run registry:build && astro build"
}
}Start the site, then in a scratch project that has a components.json:
npx shadcn@latest registry add @vcare=http://localhost:5190/r/{name}.json
npx shadcn@latest add @vcare/skeletonIf the files appear with imports rewritten to your aliases, the registry works.
Blocks and themes
- A block is a
registry:blockthat lists the UI items it composes inregistryDependencies. See the website sections. - A theme here is a
registry:stylethat ships one CSS file. See the theme playground.