---
title: Slot
description: "`Slot`は、propsを子要素にマージするコンポーネントです。"
links:
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/slot
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-slot--basic
---
```tsx
const Button = ({ asChild, ...props }) => {
const Component = asChild ? Slot : "button"
return
}
return (
)
```
## 使い方
```tsx
import { Slot, Slottable } from "@yamada-ui/react"
```
```tsx
import { Slot, Slottable } from "@/components/ui"
```
```tsx
import { Slot, Slottable } from "@workspaces/ui"
```
```tsx
```
### 複数の子要素
`Slot`は単一の子要素のみを受け入れます。複数の子要素を受け入れる場合は、`Slottable`を使用します。
```tsx
const Button = ({ asChild, children, endIcon, startIcon, ...props }) => {
const Component = asChild ? Slot : "button"
return (
{startIcon}
{children}
{endIcon}
)
}
return (
)
```