Quick start

A quick guide to getting started with Base UI.

Install the library

Install Base UI using a package manager.

Terminal
npm i @base-ui-components/react

All components are included in a single package. Base UI is tree-shakeable, so your app bundle will contain only the components that you actually use.

Set up portals

Base UI uses portals for components that render popups, such as Dialog and Popover. To make portalled components always appear on top of the entire page, add the following style to your application layout root:

layout.tsx
<body>  <div className="Root">  </div></body>
styles.css
.Root {  isolation: isolate;}

This style creates a separate stacking context for your application’s .Root element. This way, popups will always appear above the page contents, and any z-index property in your styles won’t interfere with them.

Assemble a component

This demo shows you how to import a Popover component, assemble its parts, and apply styles. There are examples for both Tailwind and CSS Modules below, but since Base UI is unstyled, you can use CSS-in-JS, plain CSS, or any other styling solution you prefer.

Next steps

This walkthrough outlines the basics of putting together a Base UI component. Browse the rest of the documentation to see what components are available in the library and how to use them.