docs/overview/quick-start

Quick start

Install the package, render a primitive and style it with its data attributes.

Install#

Install the package. React 19 is a peer dependency.

Set up the portal root#

Popups (dialogs, menus, the lightbox) are portaled to the end of <body>. Give your app's root its own stacking context, so they always show on top of it:

app/layout.tsx

Render a primitive#

Import each component from its own path and put its parts together:

pnpm add @logic-ui/react

Style it#

Parts render no styles of their own. Each one takes className and style, and exposes its state as data-* attributes to style it with:

Style the copied state

Every page lists the data attributes and CSS variables of each part in its API reference.

Change the element#

The render prop replaces the element a part renders, or composes it with one of your components. The part's props and behaviour are merged into it:

Compose your own button

Import other components#

Every component has its own path in the same package:

Import from one package

Migrate from Base UI#

Logic UI re-exports every public Base UI entry point under the same path, so it can replace @base-ui/react in an existing app. There are two ways to do it.

Keep your imports#

Alias @base-ui/react to Logic UI in package.json, then reinstall. Every import … from "@base-ui/react/…" keeps working and now resolves to Logic UI, and so do the libraries in your app that depend on Base UI:

package.json

Logic UI's own components are then imported through the same alias:

Import a Logic UI component

Switch your imports#

Or remove @base-ui/react, install @logic-ui/react, and replace the package name in your imports:

Change the imports

Either way, check which Base UI version your Logic UI release is built on in the changelog. @base-ui/react/internals/* is private API and is not re-exported.