Quick Start
Build a small React page that changes a status chip when a switch is toggled. Run the install commands after the Dalvan UI packages are available on npm.
Create the project
Use a Node.js release supported by the current Vite version.
npm create vite@latest dalvan-react -- --template react --no-interactive
cd dalvan-react
npm install react@19 react-dom@19 @dalvan-ui/react @dalvan-ui/css
Render your first component
Replace src/main.jsx with this example. The stylesheet is loaded once from the entry file.
import { useState } from "react";
import { createRoot } from "react-dom/client";
import { Chip } from "@dalvan-ui/react";
import "@dalvan-ui/css";
function App() {
const [published, setPublished] = useState(false);
return (
<main className="dv-p-300">
<article className="dv-card">
<header className="dv-card__header">
<h1 className="dv-m-0">Project status</h1>
</header>
<div className="dv-card__body dv-grid dv-gap-150">
<label className="dv-inline-flex dv-align-items-center dv-gap-100">
<input
type="checkbox"
role="switch"
className="dv-switch"
checked={published}
onChange={(event) => setPublished(event.target.checked)}
/>
Mark as published
</label>
<div aria-live="polite">
<Chip appearance="subtle" color={published ? "success" : "neutral"}>
{published ? "Published" : "Draft"}
</Chip>
</div>
</div>
</article>
</main>
);
}
createRoot(document.getElementById("root")).render(<App />);
npm run dev
Open the address printed by Vite. Toggle Mark as published to switch between Draft and Published.
Read React Foundations to see how props map to CSS classes, then explore the Chip guide.