secondsky/claude-skills / plugins/base-ui-react/skills/base-ui-react
base-ui-react
VerifiedMUI Base UI unstyled React components with Floating UI. Use for accessible components, Radix UI migration, render props API, or encountering positioning, popup, v1.0 rc / pre-GA issues.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 7.3 KB |
| assets/example-template.txt | markdown | 416 B |
| references/example-reference.md | markdown | 760 B |
| references/migration-from-radix.md | markdown | 6.7 KB |
| references/setup-guide.md | markdown | 1.9 KB |
| scripts/check-base-ui-version.shexecutable | script | 1.6 KB |
| scripts/example-script.shexecutable | script | 302 B |
| scripts/migrate-radix-component.shexecutable | script | 3.3 KB |
| templates/Accordion.tsx | other | 13.7 KB |
| templates/Dialog.tsx | other | 5.0 KB |
| templates/NumberField.tsx | other | 11.2 KB |
| templates/Popover.tsx | other | 8.6 KB |
| templates/Select.tsx | other | 8.4 KB |
| templates/Tooltip.tsx | other | 9.4 KB |
| templates/migration-example.tsx | other | 9.9 KB |
templates/Tooltip.tsx
View on GitHub// Base UI Tooltip Component
// @base-ui-components/react v1.0.0-rc.0
import * as React from "react";
import { Tooltip } from "@base-ui-components/react/tooltip";
/**
* Example: Accessible Tooltip with Base UI
*
* Key Features:
* - Hover and focus triggers
* - Keyboard accessible
* - Positioner for smart positioning
* - Delay controls
*/
export function TooltipExample() {
return (
<Tooltip.Root>
{/* Trigger */}
<Tooltip.Trigger
render={(props) => (
<button
{...props}
className="px-4 py-2 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500"
>
Hover me
</button>
)}
/>
{/* Positioner */}
<Tooltip.Positioner
side="top"
alignment="center"
sideOffset={4}
render={(props) => (
<div {...props} className="z-50">
<Tooltip.Portal>
{/* Popup */}
<Tooltip.Popup
render={(popupProps) => (
<div
{...popupProps}
className="bg-gray-900 text-white text-sm px-3 py-2 rounded-md shadow-lg max-w-xs"
>
This is a tooltip with helpful information
</div>
)}
/>
{/* Arrow */}
<Tooltip.Arrow
render={(arrowProps) => (
<div
{...arrowProps}
className="w-2 h-2 rotate-45 bg-gray-900"
/>
)}
/>
</Tooltip.Portal>
</div>
)}
/>
</Tooltip.Root>
);
}
/**
* Delayed Tooltip Example
*/
export function DelayedTooltipExample() {
return (
<Tooltip.Root
delay={500} // 500ms delay before showing
closeDelay={0} // Hide immediately
>
<Tooltip.Trigger
render={(props) => (
<button
{...props}
className="px-4 py-2 border border-gray-300 rounded-md hover:border-gray-400"
>
Hover me (500ms delay)
</button>
)}
/>
<Tooltip.Positioner side="top" alignment="center" sideOffset={4}>
<Tooltip.Portal>
<Tooltip.Popup
render={(props) => (
<div
{...props}
className="bg-gray-900 text-white text-sm px-3 py-2 rounded-md"
>
Delayed tooltip
</div>
)}
/>
</Tooltip.Portal>
</Tooltip.Positioner>
</Tooltip.Root>
);
}
/**
* Rich Content Tooltip Example
*/
export function RichTooltipExample() {
return (
<Tooltip.Root>
<Tooltip.Trigger
render={(props) => (
<button
{...props}
className="inline-flex items-center gap-1 text-blue-600 hover:underline"
>
What's this?
<svg
width="16"
height="16"
viewBox="0 0 16 16"
fill="none"
className="text-gray-400"
>
<circle cx="8" cy="8" r="7" stroke="currentColor" />
<text
x="8"
y="11"
textAnchor="middle"
fontSize="10"
fill="currentColor"
>
?
</text>
</svg>
</button>
)}
/>
<Tooltip.Positioner side="right" alignment="start" sideOffset={8}>
<Tooltip.Portal>
<Tooltip.Popup
render={(props) => (
<div
{...props}
className="bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-700 rounded-md shadow-lg p-4 w-64"
>
<h4 className="font-semibold mb-2 text-gray-900 dark:text-gray-100">
Helpful Information
</h4>
<p className="text-sm text-gray-600 dark:text-gray-400 mb-2">
This tooltip contains rich content including headings,
paragraphs, and links.
</p>
<a
href="#"
className="text-sm text-blue-600 hover:underline"
onClick={(e) => e.preventDefault()}
>
Learn more →
</a>
</div>
)}
/>
<Tooltip.Arrow
render={(props) => (
<div
{...props}
className="w-3 h-3 rotate-45 bg-white dark:bg-gray-900 border border-gray-300 dark:border-gray-700"
/>
)}
/>
</Tooltip.Portal>
</Tooltip.Positioner>
</Tooltip.Root>
);
}
/**
* Disabled State Example
*/
export function DisabledTooltipExample() {
return (
<div className="space-x-4">
<Tooltip.Root>
<Tooltip.Trigger
render={(props) => (
<button
{...props}
disabled
className="px-4 py-2 bg-gray-300 text-gray-500 rounded-md cursor-not-allowed"
>
Disabled button
</button>
)}
/>
<Tooltip.Positioner side="top">
<Tooltip.Portal>
<Tooltip.Popup
render={(props) => (
<div
{...props}
className="bg-gray-900 text-white text-sm px-3 py-2 rounded-md"
>
This button is disabled
</div>
)}
/>
</Tooltip.Portal>
</Tooltip.Positioner>
</Tooltip.Root>
</div>
);
}
/**
* Multiple Tooltips with Provider
* Share delay settings across multiple tooltips
*/
export function TooltipProviderExample() {
return (
<Tooltip.Provider delay={300} closeDelay={100}>
<div className="flex gap-4">
<Tooltip.Root>
<Tooltip.Trigger
render={(props) => (
<button {...props} className="px-4 py-2 border rounded-md">
First
</button>
)}
/>
<Tooltip.Positioner side="top">
<Tooltip.Portal>
<Tooltip.Popup
render={(props) => (
<div {...props} className="bg-gray-900 text-white px-3 py-2 rounded-md">
First tooltip
</div>
)}
/>
</Tooltip.Portal>
</Tooltip.Positioner>
</Tooltip.Root>
<Tooltip.Root>
<Tooltip.Trigger
render={(props) => (
<button {...props} className="px-4 py-2 border rounded-md">
Second
</button>
)}
/>
<Tooltip.Positioner side="top">
<Tooltip.Portal>
<Tooltip.Popup
render={(props) => (
<div {...props} className="bg-gray-900 text-white px-3 py-2 rounded-md">
Second tooltip
</div>
)}
/>
</Tooltip.Portal>
</Tooltip.Positioner>
</Tooltip.Root>
</div>
</Tooltip.Provider>
);
}
/**
* Positioning Variations
*/
export function TooltipPositionsExample() {
const positions: Array<{
side: "top" | "right" | "bottom" | "left";
alignment: "start" | "center" | "end";
}> = [
{ side: "top", alignment: "center" },
{ side: "right", alignment: "center" },
{ side: "bottom", alignment: "center" },
{ side: "left", alignment: "center" },
];
return (
<div className="grid grid-cols-2 gap-4">
{positions.map(({ side, alignment }) => (
<Tooltip.Root key={`${side}-${alignment}`}>
<Tooltip.Trigger
render={(props) => (
<button
{...props}
className="px-4 py-2 border border-gray-300 rounded-md hover:border-gray-400"
>
{side}
</button>
)}
/>
<Tooltip.Positioner side={side} alignment={alignment} sideOffset={4}>
<Tooltip.Portal>
<Tooltip.Popup
render={(props) => (
<div
{...props}
className="bg-gray-900 text-white text-sm px-3 py-2 rounded-md"
>
Tooltip on {side}
</div>
)}
/>
<Tooltip.Arrow
render={(props) => (
<div {...props} className="w-2 h-2 rotate-45 bg-gray-900" />
)}
/>
</Tooltip.Portal>
</Tooltip.Positioner>
</Tooltip.Root>
))}
</div>
);
}
/**
* Common Pitfalls:
*
* ❌ Not keyboard accessible
* <div onMouseEnter={show}>...</div> (No keyboard support)
*
* ✅ Use Tooltip.Trigger
* <Tooltip.Trigger render={(props) => <button {...props}>...</button>} />
*
* ❌ Missing Positioner
* <Tooltip.Popup /> (Won't position correctly)
*
* ✅ Wrap in Positioner
* <Tooltip.Positioner>
* <Tooltip.Portal>
* <Tooltip.Popup />
* </Tooltip.Portal>
* </Tooltip.Positioner>
*
* ❌ Tooltip on disabled button doesn't show
* <Tooltip.Trigger disabled /> (Pointer events disabled)
*
* ✅ Wrap disabled element
* <Tooltip.Trigger>
* <span className="inline-block">
* <button disabled>...</button>
* </span>
* </Tooltip.Trigger>
*/
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |