US

using-base-ui-with-material-ui

Provides standards and patterns for using Base UI components as a foundation for Material UI implementations.

Install

mkdir -p .claude/skills/using-base-ui-with-material-ui && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2213" && unzip -o skill.zip -d .claude/skills/using-base-ui-with-material-ui && rm skill.zip

Installs to .claude/skills/using-base-ui-with-material-ui

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Always use this skill when integrating Base UI components `@base-ui-components/react` with Material UI `@mui/material`.
119 chars✓ has a “when” trigger
Intermediate

Key capabilities

  • Compose Base UI primitives with Material UI styling
  • Apply Material UI theme tokens via render props
  • Create reusable wrapper components for consistent UI
  • Extend Base UI component props for type safety

How it works

It uses the render prop pattern to inject Material UI components as the visual foundation for Base UI's functional primitives.

Inputs & outputs

You give it
Base UI primitive component
You get back
Styled component using Material UI render element

When to use using-base-ui-with-material-ui

  • Build accessible navigation menus
  • Extend Base UI components with MUI styling
  • Implement custom UI components

About this skill

Announce on start: You must announce "Using Base UI with Material UI skill" when this skill is invoked.

Always have enough context from the Base UI documentation to build the component requested by the user.

Base UI as the foundation

Render Base UI components as a foundation for the UI and then pass render prop using proper Material UI components.

For example, a Navigation Menu, should use Link from Material UI as the render element for NavigationMenu.Link.:

import { NavigationMenu } from '@base-ui-components/react/navigation-menu';
import Box from '@mui/material/Box';
import Link from '@mui/material/Link';
import Typography from '@mui/material/Typography';

function MenuLink({
  icon,
  title,
  description,
  ...props
}: NavigationMenu.Link.Props & {
  icon?: React.ReactNode;
  title: string;
  description: string;
}) {
  return (
    <NavigationMenu.Link
      href="#"
      {...props}
      render={
        <Link
          underline="none"
          sx={{
            display: 'flex',
            gap: 1,
            p: 1.5,
            borderRadius: 0.5,
            cursor: 'pointer',
            transition: 'background-color 0.2s',
            '@media (hover: hover)': {
              '&:hover': {
                bgcolor: 'action.hover',
              },
            },
          }}
        />
      }
    >
      <Box sx={{ color: 'primary.main', display: 'flex', mt: 0.25 }}>
        {icon}
      </Box>
      <Box>
        <Typography variant="subtitle2" sx={{ fontWeight: 600, mb: 0.25 }}>
          {title}
        </Typography>
        <Typography
          variant="body2"
          sx={{ color: 'text.secondary', lineHeight: 1.4 }}
        >
          {description}
        </Typography>
      </Box>
    </NavigationMenu.Link>
  );
}

For full example, see nav-menu-01.tsx

Another example, using Button from Material UI as the render element for Base UI Trigger component:

import { Menu } from '@base-ui-components/react/menu';
import Button from '@mui/material/Button';

<Menu.Trigger render={<Button />}>File</Menu.Trigger>;

Styling

To style Base UI components, use <Box /> as a render element and pass sx prop to it. Always keep in mind that the sx values should be minimum since Material UI components already have default styling.

import { NavigationMenu } from '@base-ui-components/react/navigation-menu';
import Box from '@mui/material/Box';

<NavigationMenu.List
  render={
    <Box
      component="ul"
      sx={{
        display: 'flex',
        justifyContent: 'center',
        gap: 2,
        listStyle: 'none',
        '& .MuiButton-root[data-popup-open]': {
          bgcolor: 'action.selected',
        },
      }}
    />
  }
></NavigationMenu.List>;

Primitive/Non-interactive Components

For non-interactive Base UI components like Meter, Progress, Slider (read-only), etc. that don't have direct semantic Material UI equivalents, always use the render prop pattern with Box.

CRITICAL: Never use component={BaseUIComponent} - this is incorrect and causes issues. Always use Base UI components as the foundation with the render prop.

✅ Correct Pattern

import { Meter } from '@base-ui-components/react/meter';
import Box from '@mui/material/Box';

<Meter.Track
  render={
    <Box
      sx={{
        height: 8,
        width: '100%',
        bgcolor: 'action.disabledBackground',
        borderRadius: 1,
        overflow: 'hidden',
        position: 'relative',
      }}
    />
  }
>
  <Meter.Indicator
    render={
      <Box
        sx={{
          height: '100%',
          bgcolor: 'text.primary',
          transition: 'width 0.3s ease',
        }}
      />
    }
  />
</Meter.Track>;

❌ Incorrect Pattern

// ❌ NEVER do this - Base UI should be the foundation, not MUI Box
<Box component={Meter.Track} sx={{ ... }}>
  <Box component={Meter.Indicator} sx={{ ... }} />
</Box>

// ❌ NEVER do this - Using asChild prop (not a React pattern)
<Meter.Track asChild>
  <Box sx={{ ... }}>
    <Meter.Indicator asChild>
      <Box sx={{ ... }} />
    </Meter.Indicator>
  </Box>
</Meter.Track>

Key Points

  1. Base UI First: Always render Base UI components as the outer wrapper
  2. render Prop: Use render={<Box sx={{ ... }} />} to apply Material UI styling
  3. Theme Tokens: Use MUI theme tokens in sx prop (e.g., bgcolor: "action.hover", color: "text.primary")
  4. Minimal Styling: Keep sx props minimal - only add what's necessary for the design

Reduce duplication

If the same styles are used multiple times for the same Base UI components, create wrapper components to reduce duplication.

import { NavigationMenu } from '@base-ui-components/react/navigation-menu';

function Content(props: BoxProps) {
  return (
    <Box
      sx={{
        padding: 1,
        width: 'calc(100vw - 40px)',
        height: '100%',
        '@media (min-width: 500px)': {
          width: 'max-content',
          minWidth: '400px',
        },
      }}
      {...props}
    />
  );
}

<NavigationMenu.List>
  <NavigationMenu.Item>
    <NavigationMenu.Content render={<Content />}></NavigationMenu.Content>
  </NavigationMenu.Item>
  <NavigationMenu.Item>
    <NavigationMenu.Content render={<Content />}></NavigationMenu.Content>
  </NavigationMenu.Item>
  <NavigationMenu.Item>
    <NavigationMenu.Content render={<Content />}></NavigationMenu.Content>
  </NavigationMenu.Item>
</NavigationMenu.List>;

TypeScript Props Interface

CRITICAL: When creating wrapper components around Base UI primitives, NEVER duplicate props that are already provided by the Base UI component.

❌ Incorrect - Duplicating Base UI Props

import { PreviewCard } from '@base-ui-components/react/preview-card';

// ❌ BAD: Manually duplicating delay, closeDelay, defaultOpen, etc.
export interface CardPreview01Props {
  trigger: React.ReactNode;
  href: string;
  delay?: number; // Already in PreviewCard.Root.Props
  closeDelay?: number; // Already in PreviewCard.Root.Props
  defaultOpen?: boolean; // Already in PreviewCard.Root.Props
  open?: boolean; // Already in PreviewCard.Root.Props
  onOpenChange?: (open: boolean) => void; // Already in PreviewCard.Root.Props
}

✅ Correct - Extending Base UI Props

import { PreviewCard } from '@base-ui-components/react/preview-card';

// ✅ GOOD: Extend the Base UI component props
export interface CardPreview01Props extends PreviewCard.Root.Props {
  trigger: React.ReactNode;
  href: string;
  imageSrc: string;
  imageAlt: string;
  heading: string;
  description: string;
}

export function CardPreview01({
  trigger,
  href,
  imageSrc,
  imageAlt,
  heading,
  description,
  ...props // This spreads all Base UI props (delay, closeDelay, defaultOpen, etc.)
}: CardPreview01Props) {
  return (
    <PreviewCard.Root {...props}>{/* component content */}</PreviewCard.Root>
  );
}

Key Benefits

  1. Type Safety: Automatically get all Base UI prop types without manual maintenance
  2. Future-Proof: New Base UI props automatically available in your component
  3. No Duplication: Single source of truth for prop definitions
  4. Better DX: TypeScript autocomplete shows all available props

When to Define Custom Props

Only define props that are:

  • Specific to your wrapper component (like imageSrc, heading)
  • Not part of the underlying Base UI component
  • Required for your custom implementation logic

When not to use it

  • When using component={BaseUIComponent} pattern
  • When duplicating Base UI props in custom wrappers

Prerequisites

@base-ui-components/react@mui/material

Limitations

  • Requires Base UI as the outer wrapper
  • Minimal styling recommended to preserve MUI defaults

How it compares

This approach separates functional logic from visual styling, avoiding the limitations of standard component composition.

Compared to similar skills

using-base-ui-with-material-ui side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
using-base-ui-with-material-ui (this skill)63moNo flagsIntermediate
nextjs-developer3282moNo flagsAdvanced
screenshot-to-code2042moNo flagsBeginner
zustand1132moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

nextjs-developer

zenobi-us

Expert Next.js developer mastering Next.js 14+ with App Router and full-stack features. Specializes in server components, server actions, performance optimization, and production deployment with focus on building fast, SEO-friendly applications.

328531

screenshot-to-code

OneWave-AI

Convert UI screenshots into working HTML/CSS/React/Vue code. Detects design patterns, components, and generates responsive layouts. Use this when users provide screenshots of websites, apps, or UI designs and want code implementation.

204389

zustand

lobehub

Zustand state management guide. Use when working with store code (src/store/**), implementing actions, managing state, or creating slices. Triggers on Zustand store development, state management questions, or action implementation.

113434

ui-ux-expert-skill

fercracix33

Technical workflow for implementing accessible React user interfaces with shadcn/ui, Tailwind CSS, and TanStack Query. Includes 6-phase process with mandatory Style Guide compliance, Context7 best practices consultation, Chrome DevTools validation, and WCAG 2.1 AA accessibility standards. Use after Test Agent, Implementer, and Supabase agents complete their work.

91244

web-artifacts-builder

anthropics

Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use for complex artifacts requiring state management, routing, or shadcn/ui components - not for simple single-file HTML/JSX artifacts.

49162

accessibility-compliance

wshobson

Implement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.

45132

Search skills

Search the agent skills registry