Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

base-ui-guide

БесплатноБез исполняемых скриптовНе проверен

Guide for Base UI (@base-ui/react), an unstyled React component library for building accessible UIs. Use when user asks to "build a component with Base UI"…

vcode-shот vcode-sh★ 19 звёзд на GitHub

Об этом скилле

Base UI Guide

Base UI (@base-ui/react) is an unstyled React component library for building accessible user interfaces. From the creators of Radix, Material UI, and Floating UI. Components are headless, composable, and WAI-ARIA compliant. Supports React 17+ and all modern browsers (Baseline Widely Available). Tree-shakable single package.

Do NOT use this guide for Radix UI (radix-ui), Material UI (MUI @mui/material), or Shadcn/ui — those are separate libraries with different APIs.

Quick Start

npm i @base-ui/react

Setup

  1. Portals - Add stacking context isolation to prevent z-index conflicts:
.root { isolation: isolate; }
<body><div className="root">{children}</div></body>
  1. iOS 26+ Safari - For dialog backdrops:
body { position: relative; }

Import Pattern

All components use namespaced compound pattern from a single package:

import { Popover } from '@base-ui/react/popover';

<Popover.Root>
  <Popover.Trigger>Open</Popover.Trigger>
  <Popover.Portal>
    <Popover.Positioner sideOffset={8}>
      <Popover.Popup>
        <Popover.Arrow />
        <Popover.Title>Title</Popover.Title>
        <Popover.Description>Content</Popover.Description>
      </Popover.Popup>
    </Popover.Positioner>
  </Popover.Portal>
</Popover.Root>

Core Patterns

Styling (components are completely unstyled)

CSS Classes - static or state-dependent:

<Switch.Thumb className="SwitchThumb" />
<Switch.Thumb className={(state) => state.checked ? 'checked' : 'unchecked'} />

Data Attributes - all components expose state via data-* attributes:

.SwitchThumb[data-checked] { background: blue; }
.Popup[data-starting-style] { opacity: 0; transform: scale(0.9); }

CSS Custom Properties - dynamic values for layout/animation:

.Indicator { width: var(--slider-indicator-width); }
.Popup { transform-origin: var(--transform-origin); }

Works with Tailwind CSS, CSS Modules, CSS-in-JS, or plain CSS.

Composition (render prop)

Replace default elements with custom components or different HTML tags:

// Custom component (must forward ref and spread props)
<Dialog.Trigger render={<MyButton size="md" />} />

// Different HTML element
<Menu.Item render={<a href="/profile" />}>Profile</Menu.Item>

// Render function with state access
<Checkbox.Root render={(props, state) => (
  <span {...props}>{state.checked ? <CheckIcon /> : <BoxIcon />}</span>
)} />

Server Components (Next.js / RSC)

All interactive Base UI components require 'use client' in React Server Component environments. Only static display components (Separator, Avatar without interaction) can be used in server components.

Combobox List Render Pattern

Combobox and Autocomplete use a unique render-children pattern on List — pass a function that receives each filtered item:

<Combobox.List>
  {(item) => (
    <Combobox.Item key={item.value} value={item}>
      {item.label}
    </Combobox.Item>
  )}
</Combobox.List>

This differs from Select, where you explicitly .map() over items inside Select.List.

Controlled vs Uncontrolled

All interactive components support both modes:

// Uncontrolled (internal state)
<Dialog.Root defaultOpen={false}>

// Controlled (external state)
<Dialog.Root open={isOpen} onOpenChange={setIsOpen}>

Event Customization

Change handlers receive (value, eventDetails):

<Dialog.Root onOpenChange={(open, details) => {
  if (details.reason === 'escape-key') {
    details.cancel(); // Prevent closing
  }
}}>

Key eventDetails methods: cancel(), allowPropagation(). Access reason for why the change occurred.

Animation

CSS Transitions (recommended - can be cancelled midway):

.Popup {
  transition: transform 150ms, opacity 150ms;
  transform-origin: var(--transform-origin);
}
.Popup[data-starting-style],
.Popup[data-ending-style] {
  opacity: 0;
  transform: scale(0.9);
}

CSS Animations: Use [data-open] / [data-closed] with @keyframes.

JavaScript (Motion): Use keepMounted + render prop + <AnimatePresence>.

TypeScript

Types organized by namespace:

Tooltip.Root.Props          // Component props
Popover.Positioner.State    // Internal state type
Combobox.Root.ChangeEventDetails  // Event details type

Component Catalog

Overlay & Navigation

Component Parts Description
Dialog Root, Trigger, Portal, Backdrop, Popup, Title, Description, Close Modal dialog with focus trap
AlertDialog Root, Trigger, Portal, Backdrop, Popup, Title, Description, Close Confirmation dialog (no pointer dismiss)
Popover Root, Trigger, Portal, Positioner, Popup, Arrow, Title, Description Non-modal floating content
Tooltip Provider, Root, Trigger, Portal, Positioner, Popup, Arrow Hover/focus info popup
PreviewCard Root, Trigge
Полный SKILL.md на GitHub

Установить base-ui-guide в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/accessibility.mdreferences/animation.mdreferences/components-dialogs.mdreferences/components-form-controls.mdreferences/components-form-fields.mdreferences/components-indicators.mdreferences/components-menus.mdreferences/components-panels.mdreferences/composition.mdreferences/forms-typescript.mdreferences/styling.mdreferences/utilities.md

FAQ

Что делает скилл base-ui-guide?

Guide for Base UI (@base-ui/react), an unstyled React component library for building accessible UIs. Use when user asks to "build a component with Base UI", "create a form with Base UI", "style Base UI components", "animate Base UI popover", "use Base UI dialog", "add Base UI select", "implement Base UI tabs", or asks about Base UI accessibility, composition, customization, styling, animation, TypeScript types, or any of its 35+ components. Covers all components (Dialog, Menu, Popover, Select, Combobox, Tabs, Accordion, Toast, Form, Field, Slider, etc.), styling patterns, animations, composition via render props, event customization, form integration, and utilities. Do NOT use for Radix UI (radix-ui), Material UI (MUI @mui/material), or Shadcn/ui - those are separate libraries with different APIs.

Как установить скилл base-ui-guide?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл base-ui-guide запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить base-ui-guide с