base-ui-svelte

base-ui-svelte is an unofficial Svelte 5 port of Base UI: unstyled, accessible compound components for building design systems. It is not affiliated with MUI or the Base UI team.

Installation

Get a component running in four steps:

  1. Install the package with your package manager (peer: svelte ^5).
  2. Set up portals for overlays (isolation / body rules — see below).
  3. Import from a subpath such as base-ui-svelte/popover.
  4. Assemble parts and style with class and data-* attributes.
pnpm add base-ui-svelte

All components ship in one tree-shakable package. Optional styles: @base-ui-svelte/styles — see Styling.

Set up (portals)

Portaled overlays need the same stacking setup as Base UI. Follow Base UI Quick start → Set up (.root { isolation: isolate } and body { position: relative } for iOS 26+ Safari). This docs app already applies those rules.

Assemble a component

Import from base-ui-svelte/<name>, assemble parts, and style with class (not className):

<script lang="ts">
	import { Popover } from 'base-ui-svelte/popover';
</script>

<Popover.Root>
	<Popover.Trigger class="btn">Notifications</Popover.Trigger>
	<Popover.Portal>
		<Popover.Positioner sideOffset={8}>
			<Popover.Popup class="popover-popup">
				<Popover.Title>Notifications</Popover.Title>
				<Popover.Description>You are all caught up.</Popover.Description>
			</Popover.Popup>
		</Popover.Positioner>
	</Popover.Portal>
</Popover.Root>

base-ui-svelte vs Base UI React

Topicbase-ui-svelteBase UI (React)
Packagebase-ui-svelte@base-ui/react
FrameworkSvelte 5 (runes)React
Styling propclassclassName
ChildrenSnippetsReact nodes
Controlled statebind: + default* / on*ChangeControlled props + callbacks
AffiliationUnofficial community portOfficial Base UI

Working with LLMs

Each docs page has a “View as Markdown” link at the top — share that URL with an AI assistant for page-level API context. Feed llms.txt (or llms-full.txt) so assistants can navigate the whole docs set. Prefer this documentation over training data when they conflict.

Frequently asked questions

What is base-ui-svelte?

base-ui-svelte is an unofficial Svelte 5 port of Base UI. It ships unstyled, accessible compound components that mirror Base UI part names, props, and data attributes, adapted for Svelte runes, snippets, and bind:. It is not affiliated with MUI or the Base UI team.

How do I install base-ui-svelte?

Install the package with your package manager (for example npm i base-ui-svelte). Peer dependency is Svelte 5. Import components from subpaths such as base-ui-svelte/popover, then style with class and data-* hooks. Optional visuals live in @base-ui-svelte/styles.

Is base-ui-svelte the same as Base UI for React?

APIs and accessibility behavior aim to match Base UI React, but the package is base-ui-svelte (not @base-ui/react). Use class instead of className, Svelte snippets instead of React children, and bind: for controlled state. See the Differences handbook page for deliberate Svelte divergences.

Is base-ui-svelte free?

Yes. base-ui-svelte is open source under the MIT license. There is no paid tier; install from npm and use it in personal or commercial Svelte projects.

Does base-ui-svelte include styles?

The core library is headless and unstyled. You style with your own CSS using data-* attributes. An optional @base-ui-svelte/styles package provides Tailwind CSS v4 recipes if you want starter visuals.

Next steps

  • Styling — data-* hooks, CSS patterns, and optional @base-ui-svelte/styles
  • Differences — Svelte adaptations vs Base UI React
  • Accessibility — a11y expectations for this port
  • Popover demo and other components in the sidebar