Skip to contents

Quick start

A quick guide to getting started with Base UI.

Install the library

Install Base UI using a package manager.

pnpm add base-ui-solid solid-js@2 @solidjs/web@2

Base UI Solid requires Solid 2.0, with the compiler configured for jsxImportSource: "@solidjs/web". Solid 1.x is not supported.

All components are included in a single package. Base UI is tree-shakable, 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 portaled components always appear on top of the entire page, add the following style to your application layout root:

layout.tsx
<body>
  <div class="root">
    {/* prettier-ignore */}
    {children}
  </div>
</body>
styles.css
.root {
  isolation: isolate;
}

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

iOS 26+ Safari

Starting with iOS 26, Safari allows content beneath the UI chrome to be visible. Backdrops such as those used by dialogs must use position: absolute instead of position: fixed to cover the entire visual viewport. For this to work after the page is scrolled, the following style must be added to your global styles:

styles.css
body {
  position: relative;
}

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.

import type { JSX } from '@solidjs/web';
import { Popover } from 'base-ui-solid/popover';
import styles from './index.module.css';

export default function ExamplePopover() {
  return (
    <Popover.Root>
      <Popover.Trigger class={styles.IconButton} aria-label="Shipping information">
        <InfoIcon />
      </Popover.Trigger>
      <Popover.Portal>
        <Popover.Positioner sideOffset={8}>
          <Popover.Popup class={styles.Popup}>
            <Popover.Arrow class={styles.Arrow} />
            <Popover.Title class={styles.Title}>Free shipping</Popover.Title>
            <Popover.Description class={styles.Description}>
              Orders over $50 arrive in 3–5 business days at no extra cost.
            </Popover.Description>
            <a href="#" class={styles.Link}>
              View shipping policy
            </a>
            <Popover.Close aria-label="Close" class={styles.Close}>
              <XIcon />
            </Popover.Close>
          </Popover.Popup>
        </Popover.Positioner>
      </Popover.Portal>
    </Popover.Root>
  );
}

function InfoIcon(props: JSX.IntrinsicElements['svg']) {
  return (
    <svg
      width="16"
      height="16"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      stroke-linecap="square"
      stroke-linejoin="round"
      {...props}
      style={
        typeof props.style === 'string'
          ? `display: block; ${props.style}`
          : { display: 'block', ...(typeof props.style === 'object' ? props.style : {}) }
      }
    >
      <circle cx="8" cy="8" r="6.5" />
      <path d="M8 7.5v3.5" />
      <circle cx="8" cy="5" r="0.75" fill="currentColor" stroke="none" />
    </svg>
  );
}

function XIcon(props: JSX.IntrinsicElements['svg']) {
  return (
    <svg
      width="16"
      height="16"
      viewBox="0 0 16 16"
      fill="none"
      stroke="currentColor"
      stroke-linecap="square"
      stroke-linejoin="round"
      {...props}
      style={
        typeof props.style === 'string'
          ? `display: block; ${props.style}`
          : { display: 'block', ...(typeof props.style === 'object' ? props.style : {}) }
      }
    >
      <path d="m4.5 4.5 7 7m-7 0 7-7" />
    </svg>
  );
}

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.

Next steps

This walkthrough outlines the basics of putting together a Base UI component. Continue to the Handbook section for broader guidance on topics like styling, animation, and composition, or explore the components.