Skip to main content
v7

Slot

Merges its props onto the single child element, composing event handlers and classNames automatically.

Package@g4rcez/componentsSectionPrimitives

Examples

Basic Prop Merging

Slot passes its props down to the child element, merging className and event handlers.

Basic
This text inherits the className from Slot

Event Handler Composition

Both the Slot and child onClick handlers fire when the element is clicked.

Event composition

Custom Slot via createSlot

createSlot creates a named Slot for use as an asChild pattern in component primitives.

createSlot

When to use Slot

Use when

You need the documented Slot interaction or presentation in a product workflow.

Avoid when

A native HTML element already provides the Slot behavior you need.

Accessibility

Keep the Slot labeled and use its documented keyboard interaction. The component preserves visible focus and communicates state without relying on color alone.