Installation
Get Ajax UI set up in your project using the CLI or manual installation.
Using the CLI (recommended)
The ajaxui CLI lets you add individual components straight into your project.
1. Install the CLI
Install it globally with your package manager of choice, or skip this step and use npx in the next step.
npm install -g ajaxuipnpm add -g ajaxuiyarn global add ajaxui2. Add a component
npx ajaxui add button3. Import and use it
import { Button } from "@/components/ui/button"
export default function App() {
return <Button>Click me</Button>
}Manual installation
You can also install the package directly and import components from it.
Install the package
npm install @ajax-ui/reactpnpm add @ajax-ui/reactyarn add @ajax-ui/reactAdd the Tailwind preset
// tailwind.config.ts
import type { Config } from "tailwindcss"
import ajaxPreset from "@ajax-ui/tailwind"
const config: Config = {
presets: [ajaxPreset],
content: ["./src/**/*.{ts,tsx}"],
}
export default configImport global styles
import "@ajax-ui/tailwind/src/globals.css"TypeScript
All components include full TypeScript definitions. No extra configuration required.
import type { ButtonProps } from "@ajax-ui/react/button"
function MyButton(props: ButtonProps) {
// fully typed!
}