Foundations
FoundationsTier 2 · Primitives
IconSlot
The seam where your app's icon enters a Woohl component. Owns optical size so a 15px icon stays 15px whichever library drew it.
bunx --bun shadcn@latest add @woohl/icon-slotReference
Installs this item, its registry dependencies and the token layer.
bunx --bun shadcn@latest add @woohl/icon-slotregistry/tier-2-primitives/icon-slot.tsx
import type { ReactElement } from "react";
import { cn } from "@/registry/tier-2-primitives/lib/utils";
/** Wraps consumer icon nodes to enforce optical sizing. */
export function IconSlot({
icon,
size,
className,
}: {
icon: ReactElement | null | undefined;
/** Optical size in px. Set by the component, not the call site. */
size: number;
className?: string;
}) {
if (!icon) return null;
return (
<span
aria-hidden
data-slot="icon"
className={cn(
"inline-grid flex-none place-items-center [&>svg]:size-full",
className,
)}
style={{ width: size, height: size }}
>
{icon}
</span>
);
}
This item exports no props — it is a stylesheet, a helper or a set of constants.
Registry items
npm packages
None beyond React itself.