SlotPolymorphic

Primitive #5

🔍 Problem it solves

Your button component always renders a <button> element. But sometimes users need an <a> tag for navigation, a <div> for custom styling, or a <span> for inline buttons.

✅ Solution

Accepts an as prop (e.g., as="a"). Instead of rendering its own element, it returns a pure descriptor { as, children, attrs } that can be consumed by any framework (React, Vue, Angular, Svelte) or vanilla JS. The adapter then creates the actual DOM element using its own rendering system.

🧩 Used by components

Button, Link, MenuItem, DialogTrigger, TabsTrigger, BreadcrumbItem

🎮 Interactive demo (vanilla JS adapter)