- Accordion
- Attachment
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Card
- Checkbox
- Code Block
- Collapsible
- Dialog
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Label
- Marker
- Message
- Number Flow
- Pagination
- Popover
- Progress
- Radio Group
- Select
- Slider
- Sonner
- Spinner
- Switch
- Tooltip
- Separator
- Sheet
- Tabs
- Textarea
- Toggle
- Toggle Group
- Trace
Frakment works in a monorepo where one package holds the components and multiple apps import from it. This guide uses Turborepo + pnpm workspaces as the reference setup — the same pattern works with npm/yarn workspaces and Nx.
Prerequisites
- A working monorepo (Turborepo, Nx, or plain workspaces)
- TypeScript shared across packages
- Tailwind CSS v4 in the UI package
Project structure
Set up the UI package
From packages/ui, run init:
cd packages/ui
npx frakment@latest initPoint to src/styles.css when prompted. Components land in src/components/ui/.
Add a component:
$ bunx --bun frakment@latest add button bubble$ npx frakment@latest add button bubble$ pnpm dlx frakment@latest add button bubble$ yarn dlx frakment@latest add button bubble
Share the package
In packages/ui/package.json, expose the components and styles:
{
"name": "@myorg/ui",
"version": "0.0.0",
"private": true,
"exports": {
"./*": "./src/components/ui/*.tsx",
"./styles.css": "./src/styles.css"
},
"peerDependencies": {
"react": "^19.0.0",
"react-dom": "^19.0.0",
"tailwindcss": "^4.0.0"
}
}Import from apps
In apps/web/package.json:
{
"dependencies": {
"@myorg/ui": "workspace:*"
}
}In apps/web/app/layout.tsx:
import "@myorg/ui/styles.css";In any page:
import { Button } from "@myorg/ui/button";
export default function Page() {
return <Button>Click me</Button>;
}Tailwind content scanning
Tailwind v4 scans the source of every dependency automatically. If styles do not apply, add the UI package to @source in the app CSS:
@import "tailwindcss";
@import "@myorg/ui/styles.css";
@source "../../../packages/ui/src";Best practices
- One
components.jsonper package. Do not init from the monorepo root. - Shared
tsconfig.jsonbase. Every app must resolve@myorg/uifrompathsor workspace protocol. - Peer dependencies for UI. Add
react,react-dom, andtailwindcssas peers — not dependencies — inpackages/ui. - One Tailwind config per app. Each app can override tokens via its own
globals.css.
Common errors
Tailwind is not scanning packages/ui/src. Add @source "../path/to/packages/ui/src" in the app CSS after the Tailwind import.
Check the exports field in packages/ui/package.json. Each subpath must exist. Run pnpm install after changing exports.
Two React copies are loaded. Add react and react-dom to peerDependencies in packages/ui, and enable resolve.dedupe in the app Vite config if needed.
Next
- React 19 - peer deps and breaking changes
- Tailwind CSS v4 - required version
- Theming - override tokens per app