For AI agents: the complete documentation index is available at https://ifhover.github.io/leaf-ui/en/llms.txt, the full documentation bundle is available at https://ifhover.github.io/leaf-ui/en/llms-full.txt, and this page is available as Markdown at https://ifhover.github.io/leaf-ui/en/guide/getting-started.md.

Installation & quick start

Leaf UI supports React 18 and React 19. Install the package to start using components; base and component styles load automatically.

Install the package

Run this in your React project directory:

pnpm add @ifhover/leaf-ui

React 18 or 19 and the matching React DOM version must be installed in your application. If needed, run pnpm add react react-dom. See the current release on npm.

Browser component entries load theme variables, shared styles and the required component and service styles automatically. No manual CSS imports or Sass installation are needed. See server-side rendering for framework-specific setup in Next.js, TanStack Start and other frameworks.

Leaf UI styles are placed inside @layer leaf-ui so utility classes and application styles can override component defaults cleanly. Because unlayered global CSS always takes precedence over @layer rules, move any project-wide global reset CSS into @layer base. See Tailwind CSS for layer order setup.

Examples use Flex, Space, Grid and FormField for layout. Tailwind CSS is not required.

Use a component

Import components directly from @ifhover/leaf-ui and add content and events:

getting-started.tsx
import { Button } from '@ifhover/leaf-ui';
import { useState } from 'react';

export function GettingStartedExample() {
  const [count, setCount] = useState(0);

  return <Button onClick={() => setCount((value) => value + 1)}>Clicked {count} times</Button>;
}

The root entry is the recommended default. Vite and Rsbuild / Rspack production builds retain styles for named imports and their internal dependencies on demand; component subpaths are optional. Direct esbuild bundles retain CSS traversed through the root entry. In that case, use subpaths such as @ifhover/leaf-ui/button to reduce stylesheet size.

Next steps