Slot
Pre-alphaThe registry and the CLI are not published yet.Roadmap

Slot

Merges props and ref onto its single child. The engine behind asChild.

Installation

npx axiom add slot
pnpm dlx axiom add slot
yarn dlx axiom add slot
bun x axiom add slot

What it does

Slot renders its only child and merges its own props and ref onto it. Components use it to support the asChild pattern: instead of rendering their default element, they pass their behavior and props to the element you provide.

<Button asChild>
	<Link href="/settings">Settings</Link>
</Button>

Here the link receives the button’s props and styles, and no extra wrapper is rendered.

Features

  • Merges props onto the child.
  • Forwards the ref to the child.
  • Expects exactly one child.