/ui:hydrate-componentsfrom Diorama UI
Guides hydration decisions for Diorama components in Astro SSR/static exports. Helps determine which components need client directives and how to compose compound components in islands.
Ships in Diorama UI. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Astro renders a React component to static HTML unless it is given a
client:* directive. Every component renders; the question is whether it
works without hydrating, and hydrating costs the React client (~70 KB gzip)
plus Base UI. Decide per component with the table below, then hydrate only
what is in the last two columns.
| Static-safe — ship as HTML | Renders, but inert until hydrated | Needs hydration to be correct at all |
|---|---|---|
Button (incl. render={<a/>}), Badge, Banner, Card, Avatar, AspectRatio, ImageOverlay, Thumbnail, DotPattern, Skeleton, Progress, EmptyState, ChatMessage, Input, Textarea | Accordion, Tabs, Header (affix, menus), NavRail, Sidebar, Fade (with scrollContainer it renders hidden until measured), Table (sorting) | Menu, ContextMenu, Select, MultiSelect, Popover, Tooltip, Modal, Sheet, Drawer, Toast, DatePicker, Calendar, Slider, CardSorting, ImageUpload, ImageEdit, the Chat composites |
Checkbox, Radio, Switch — their checked look is drawn from the native :checked, so they toggle and submit as plain form controls |
Notes that cost someone a bug:
isIndeterminate needs JavaScript: indeterminate is a DOM
property with no HTML attribute. Statically it renders as plain unchecked.aria-invalid, so a vanilla
validation script can set aria-invalid="true" and get the danger edge with
no React render. The error message (errorText) is still render-time —
render it statically if the server knows it, or write it from the script.<Tabs.Panel isAlwaysMounted>; it is hidden with the
hidden attribute until selected.<details name="…"> group is lighter; a <details>-based Accordion
variant is not built yet.The fx effects (glass, grain, sheen, glow, shimmer, ink) are CSS on a
class: static-safe on every component above, before and without hydration.
The shader effects (gradient, halo) need startShaders() in a client
script — not a hydrated component. It is safe to import on the server (it
does nothing there) and leaves every component exactly as rendered until it
runs, so a static page shows the plain fill, never a gap:
<script>
import { startShaders } from "@/lib/shader";
startShaders();
</script>
.astroAstro passes children to a React component as static HTML outside the React tree, so this loses its context and breaks:
<!-- ✗ Accordion.Item never finds its Accordion -->
<Accordion client:visible>
<Accordion.Item value="a">
<Accordion.Trigger>Question</Accordion.Trigger>
<Accordion.Panel>Answer</Accordion.Panel>
</Accordion.Item>
</Accordion>
Write one small React wrapper per compound you use from Astro, data-driven, and hydrate the wrapper:
// src/islands/faq.tsx
export function Faq({ items }: { items: { q: string; a: string }[] }) {
return (
<Accordion>
{items.map((it) => (
<Accordion.Item key={it.q} value={it.q}>
<Accordion.Trigger>{it.q}</Accordion.Trigger>
<Accordion.Panel>{it.a}</Accordion.Panel>
</Accordion.Item>
))}
</Accordion>
);
}
Applies to every component with sub-parts: Accordion, Tabs, Card, Modal, Sheet, Drawer, Menu, Popover, RadioGroup/Radio, Header, Sidebar, NavRail. Card is the exception that works in practice — it has no context — but keep it in React anyway so its heading ids stay paired.
For a CTA that is plain markup in an .astro file, use the class recipe
instead of a React island: buttonClassName({ variant: "primary" }) on the
<a>, plus data-disabled and aria-disabled="true" if it can be disabled.
| Trap | Rule |
|---|---|
prettier-plugin-tailwindcss reorders classes in installed source, so every file "diverges" from the registry in sync | Add the installed paths to .prettierignore |
Ignoring only src/ui | Items also install outside it: src/lib/cn.ts, src/lib/motion.ts, src/lib/compose-event-handlers.ts, src/hooks/use-controllable-state.ts (and the other hooks). Ignore every path in your ui.lock.json |
Deleting *.doc.ts to slim the app | Keep them. Nothing imports them, so they never reach a bundle; deleting one makes sync report the item as modified |
A global :focus-visible { outline: … } draws a second ring inside every field | Put global focus styles in @layer base. Unlayered rules beat the components' utilities, including Input's outline-none |
| No tokens | Install the theme-zero-css item and import it after @import "tailwindcss"; |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub bydiorama/ui --plugin ui8 skills in this plugin
/animate-app-interactionsAnimate state changes in an app that consumes Diorama components. Use when a count, label, icon or list should animate, a transition does not replay, or an interaction must respect reduced motion./apply-effectsApply glass, grain, sheen, glow, shimmer, ink or shaders to Diorama components. Use when adding texture, emphasis, a gradient ground or a loading halo without changing the component API./build-demo-pageTurn a screen design into a scripted, interactive demo page. Use when storyboarding a UI walkthrough, animating a Paper mockup, or preparing component snippets and compositions for capture./compare-ui-to-designMeasure a rendered screen against a Paper or Figma design. Use when asked to match a frame, explain a spacing or size difference, export a reference, or set up pixel diffs in an app./design-componentDesign a component and its states before implementation, as a contract in code drawn in Paper or Figma. Use when turning references into a token-based spec, extending a component sheet, drawing motion frames or preparing a handoff./polish-interfacePolish an interface built with Diorama components. Use when spacing, radii, elevation, type, icon alignment, hit areas or interaction states look or feel wrong without a specific design frame to compare.Other plugins' skills for the same job