From harness-claude
Style accessible headless components from Radix UI and Headless UI with Tailwind data-attribute selectors
How this skill is triggered — by the user, by Claude, or both
Slash command
/harness-claude:css-headless-uiThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
> Style accessible headless components from Radix UI and Headless UI with Tailwind data-attribute selectors
Style accessible headless components from Radix UI and Headless UI with Tailwind data-attribute selectors
data-state, data-side, data-orientation) that reflect internal state. Use Tailwind's data-*: variants to style these states.data-[state=open]:, data-[state=closed]:, data-[side=top]:, etc.className function pattern for state-based styling.data-[state=open]:animate-* or the Transition component.// Radix UI Dialog styled with Tailwind
import * as Dialog from '@radix-ui/react-dialog';
function Modal({
trigger,
title,
children,
}: {
trigger: React.ReactNode;
title: string;
children: React.ReactNode;
}) {
return (
<Dialog.Root>
<Dialog.Trigger asChild>{trigger}</Dialog.Trigger>
<Dialog.Portal>
<Dialog.Overlay
className="
fixed inset-0 bg-black/50
data-[state=open]:animate-fade-in
data-[state=closed]:animate-fade-out
"
/>
<Dialog.Content
className="
fixed top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2
w-full max-w-md bg-white rounded-lg shadow-xl p-6
data-[state=open]:animate-scale-in
data-[state=closed]:animate-scale-out
focus:outline-none
"
>
<Dialog.Title className="text-lg font-semibold">{title}</Dialog.Title>
<Dialog.Description className="text-sm text-gray-500 mt-1">{children}</Dialog.Description>
<Dialog.Close className="absolute top-4 right-4 text-gray-400 hover:text-gray-600">
<XIcon className="h-4 w-4" />
</Dialog.Close>
</Dialog.Content>
</Dialog.Portal>
</Dialog.Root>
);
}
// Radix UI Dropdown Menu
import * as DropdownMenu from '@radix-ui/react-dropdown-menu';
function UserMenu() {
return (
<DropdownMenu.Root>
<DropdownMenu.Trigger className="flex items-center gap-2 rounded-md px-3 py-2 hover:bg-gray-100">
<Avatar /> <ChevronDown className="h-4 w-4" />
</DropdownMenu.Trigger>
<DropdownMenu.Portal>
<DropdownMenu.Content
className="min-w-[200px] bg-white rounded-md shadow-lg border p-1 data-[state=open]:animate-scale-in"
sideOffset={5}
>
<DropdownMenu.Item
className="
flex items-center gap-2 rounded px-2 py-1.5 text-sm
outline-none cursor-pointer
data-[highlighted]:bg-gray-100
"
>
Profile
</DropdownMenu.Item>
<DropdownMenu.Item
className="
flex items-center gap-2 rounded px-2 py-1.5 text-sm
outline-none cursor-pointer
data-[highlighted]:bg-gray-100
"
>
Settings
</DropdownMenu.Item>
<DropdownMenu.Separator className="h-px bg-gray-200 my-1" />
<DropdownMenu.Item
className="
flex items-center gap-2 rounded px-2 py-1.5 text-sm text-red-600
outline-none cursor-pointer
data-[highlighted]:bg-red-50
"
>
Sign out
</DropdownMenu.Item>
</DropdownMenu.Content>
</DropdownMenu.Portal>
</DropdownMenu.Root>
);
}
Radix UI data attributes:
data-state="open" | "closed" — Dialog, Popover, Dropdown, Collapsibledata-state="checked" | "unchecked" | "indeterminate" — Checkbox, Switchdata-state="active" | "inactive" — Tabsdata-highlighted — currently focused menu item (keyboard/hover)data-disabled — disabled itemdata-side="top" | "right" | "bottom" | "left" — Popover, Tooltip positioningdata-orientation="horizontal" | "vertical" — Tabs, SliderTailwind data attribute syntax: data-[attribute=value]: maps to [data-attribute="value"]:
className = 'data-[state=open]:bg-blue-50 data-[disabled]:opacity-50';
Headless UI (Tailwind Labs):
import { Menu } from '@headlessui/react';
<Menu.Item>
{({ active, disabled }) => (
<button
className={clsx(
'block w-full text-left px-4 py-2 text-sm',
active && 'bg-blue-500 text-white',
disabled && 'opacity-50'
)}
>
Option
</button>
)}
</Menu.Item>;
shadcn/ui approach: Wraps Radix primitives with CVA variants and Tailwind classes. Components are copied into your project (not installed as a dependency), giving you full control:
npx shadcn-ui@latest add dialog
# Creates components/ui/dialog.tsx with pre-styled Radix Dialog
https://www.radix-ui.com/primitives/docs/overview/introduction
npx claudepluginhub intense-visions/harness-engineering --plugin harness-claudeBuild accessible design systems with Radix UI primitives. Headless component customization, theming strategies, and compound component patterns for production-grade UI libraries.
Provides Tailwind CSS advanced UI components using CVA for variants, sizes, compounds like buttons and cards. Useful for React apps needing variant management.
Builds reusable Tailwind CSS component patterns using template abstraction, @apply directive, CVA, and plugins for React/TypeScript apps.