Slots

A slot is a placeholder inside a child component's template that allows a parent component to inject custom content, making the child component flexible and reusable by letting the parent control parts of its layout.

Example

Logo of react React 19, Functional components

ChildComponent.jsx

ParentComponent.jsx

Logo of vue Vue 3.5, Composition API

ChildComponent.vue

ParentComponent.vue

Fallback

Slots should have fallback (default) content.

Logo of react React 19, Functional components

IconButton.jsx

Usage:

Logo of vue Vue 3.5, Composition API

IconButton.vue

Usage: