Somewhere in a dialog component, a team added asChild to let a product team swap in their own trigger button. A few weeks later, someone filed a bug: the wrapper was still constructing an array of children, breaking the single-target invariant the prop depends on, and disabling the close button wasn't actually a fix because the underlying composition was never valid in the first place (delinoio/apps #1335). Nobody had touched the type signature. TypeScript was satisfied the whole time. The bug lived entirely in behavior the compiler couldn't see.
That's the asChild story in miniature, and it's worth sitting with before you reach for the pattern as your default answer to API bloat.
The Pitch: One Prop Instead of a Component Family
The appeal is obvious if you've read anything about boolean explosion in component APIs — and I've written about this before: seven booleans on a button produce 128 combinations, three of which anyone designed (Adroit). The usual fix is collapsing competing flags into a single variant prop or a discriminated union, which at least bounds the combinatorics to what the type system can enforce (Adamarant).
asChild promises something similar for element polymorphism. Instead of building LinkButton, IconButton, SubmitButton, and whatever else a product needs — each one a slightly different fork of the same component — you ship one primitive that renders its child's element instead of its own. One API surface, arbitrary underlying markup. No new component to review, no new variant to document. It looks like the same move that fixes prop explosion: trade a combinatorial mess of options for one flexible seam.
The Seam Is Still a Contract — It Just Moved
Here's where the analogy breaks down. A variant prop is checked at compile time. asChild is checked, if at all, at runtime, by behavior nobody writes a type for.
The clearest framing I've found treats escape hatches like asChild, slots, and render props as APIs in their own right, not as an absence of API (Everyday Programmer). Once a consumer can swap the rendered element, they inherit responsibility for everything that element was quietly doing: forwarding event handlers, carrying the ref the primitive expects, preserving the accessible name, keeping the right interactive semantics. Radix's own composition guidance says as much — custom leaf components need to spread the props they receive and support the expected ref, and the library explicitly leaves accessibility correctness to the consumer once the underlying element changes (Everyday Programmer).
That's a real cost, and it's a different kind of cost than a bloated prop table. A fourteen-prop button is legible — ugly, but you can read the whole interface in one sitting. A dialog trigger with asChild looks like a two-line API and is actually a contract spanning event composition order, ref forwarding, and ARIA semantics that live nowhere in the type signature. The GitHub issue above is what happens when that contract gets violated silently: a wrapper component accepted the prop, broke the invariant it depends on, and the type checker had nothing to say about it.
When the Trade Is Worth Making
I don't think this makes asChild a mistake. It's the right tool when the alternative really is a combinatorial explosion of near-duplicate components — a trigger that needs to render as a button, a link, or a custom product component, where forking three components would create the exact drift problem boolean props create (Adamarant). The pattern earns its keep at genuine composition boundaries, not as a general-purpose escape from writing a second component.
The discipline that makes it survivable is the one most teams skip: write down, explicitly, what a custom child is allowed to change and what it must preserve. Visual treatment and underlying element, sure. Accessible name, interactive semantics, and the documented event-ordering behavior, not negotiable (Everyday Programmer). That list belongs in your docs next to the component, not inferred from reading Radix's source.
If your design system has an asChild prop and nobody can tell you, off the top of their head, what a replacement child is required to preserve, you don't have a flexible primitive. You have a boolean-explosion problem wearing a nicer costume — one that fails at runtime instead of in a pull request review, which is a worse place to find it.
