Quick start
A quick guide to getting started with Base UI.
View as MarkdownInstall the library
Install Base UI using a package manager.
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:
<body>
<div className="root">
{children}
</div>
</body>
.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.
Working with LLMs
For those of you working with LLMs, each docs page has a “View as Markdown” link at the top, which can be shared with AI chat assistants to help them understand Base UI concepts and component APIs.
Additionally, there is an “llms.txt” link in the “Handbook” section of the navigation sidebar, which you can feed to AI chat assistants to help them navigate the docs.