Get started with whisk/ui and React
Install the whisk/ui React adapter, load the shared stylesheet, provide a theme, and render a component.
Install
Add the Whisk/UI React adapter and its shared stylesheet to an existing React application.
bun add @smoothie-framework/whisk-react @smoothie-framework/whisk-stylesLoad styles
Import the generated Whisk/UI stylesheet once from your client entrypoint. Do not attach tokens as inline styles on html or body.
Need custom utility values or component recipes? Configure the build plugin.
import { createRoot } from "react-dom/client";
import "@smoothie-framework/whisk-styles/styles.css";
import { App } from "./app.js";
const container = document.getElementById("app");
if (!container) throw new Error("Missing #app root");
createRoot(container).render(<App />);Provide the theme
Wrap the application once with ThemeProvider. It selects the precompiled theme scope used by every Whisk/UI component in the tree.
import {
Box,
Heading,
Stack,
Text,
ThemeProvider,
} from "@smoothie-framework/whisk-react";
export function App() {
return (
<ThemeProvider mode="light">
<Box padding={6}>
<Stack gap={4}>
<Heading level={1} textStyle="h1">Whisk/UI is ready</Heading>
<Text>Your first themed component is rendering.</Text>
</Stack>
</Box>
</ThemeProvider>
);
}App boundary
Native Whisk/UI components use ordinary React callbacks and do not need a catalog. Use an application-owned catalog only when you render generated UI, and keep the resulting actions, state changes, and side effects in your application.