Getting Started
Install the Kosmesis CLI and add your first component.
Prerequisites
Kosmesis expects a create-praxisjs-scaffolded project (the minimal,
full, or router template all work) using Vite. If you don't have one yet:
npm create praxisjs@latest my-app
cd my-appSetup
Run init
From the root of your PraxisJS project:
npx kosmesis initThis will:
- Write a
components.jsonconfig file. - Add
@import "tailwindcss";plus Kosmesis's theme tokens (--background,--foreground,--primary, ...) to your global stylesheet. - Wire the
@tailwindcss/viteplugin into yourvite.config.ts. - Create
src/lib/utils.tsexporting acn()helper (clsx+tailwind-merge).
Add a component
npx kosmesis add buttonpnpm dlx kosmesis add buttonyarn dlx kosmesis add buttonbunx kosmesis add buttonThis copies button.tsx into src/components/ui/button.tsx. If the component wraps a Morphos
primitive, its package (e.g. @morphos/inputs) is added to your package.json automatically —
run your package manager's install afterwards to fetch it.
Use it
import { Button } from "@/components/ui/button";
@Component()
class MyPage extends StatefulComponent {
render() {
return <Button variant="outline">Click me</Button>;
}
}@/components/ui/... assumes a @/* → ./src/* path alias in tsconfig.json. Add one if your
create-praxisjs template doesn't already have it, or adjust the aliases in components.json
to use relative imports instead.
Updating a component
There's no update command — because there's no dependency to update. If a newer version of a
component ships better defaults, re-run kosmesis add <component> and diff the result before
overwriting your local copy (or just apply the change by hand).