# Nested component slots

**URL:** <https://forum.elixirforum.com/t/nested-component-slots/56081>\
**Category:** Questions\
**Tags:** phoenix, function-component\
**Created:** [May 24, 2023, 3:01pm UTC](https://forum.elixirforum.com/t/nested-component-slots/56081 "2023-05-24T15:01:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![anthonator](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/anthonator/32/14467_2.png) [@anthonator](https://forum.elixirforum.com/u/anthonator)\
**Post date:** [May 24, 2023, 3:01pm UTC](https://forum.elixirforum.com/t/nested-component-slots/56081/1 "2023-05-24T15:01:40Z")

</div>

Hey all!

I understand that slots cannot be nested and I’m wondering 1) is there a good workaround that anybody has come across and 2) why isn’t this allowed?

Here is a simple example to illustrate what I’d like to do.

```elixir
<.input_group>
  <:label>
    Password
    <:corner_hint>
      <a href="#">Forgot your password?</a>
    </:corner_hint>
  </:label>
</.input_group>

```

The `:label` slot simply passes it’s content to a `.label` component that has a `:corner_hint` slot.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![LostKobrakai](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lostkobrakai/32/3072_2.png) [@LostKobrakai](https://forum.elixirforum.com/u/LostKobrakai)\
**Post date:** [May 24, 2023, 3:32pm UTC](https://forum.elixirforum.com/t/nested-component-slots/56081/2 "2023-05-24T15:32:47Z")

</div>

> [@anthonator](#):
>
> The `:label` slot simply passes it’s content to a `.label` component that has a `:corner_hint` slot.

I don’t think there’s a way to know that is indeed happening, meaning there’s no way to enforce correctness. That enforcement however is one of the features heex wants to supply.

Also where would the support for nesting end?

---

<div class="post-metadata">

**Author:** ![anthonator](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/anthonator/32/14467_2.png) [@anthonator](https://forum.elixirforum.com/u/anthonator)\
**Post date:** [May 24, 2023, 4:21pm UTC](https://forum.elixirforum.com/t/nested-component-slots/56081/3 "2023-05-24T16:21:02Z")

</div>

The assumption I had when I came across this issue was that maybe they hadn’t got to implementing support for it yet. I’ve personally felt like `slot/3` is a little lacking right now. Maybe it just needs more time to bake and we’ll see support for things like this in the future. Not being able to nest slots seems like it really limits their utility so hopefully we’ll see it in the future.

Would still love any patterns or workarounds or best practices for this if anybody know of any.

---

<div class="post-metadata">

**Author:** ![iwarshak](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/iwarshak/32/17852_2.png) [@iwarshak](https://forum.elixirforum.com/u/iwarshak)\
**Post date:** [February 8, 2025, 5:35am UTC](https://forum.elixirforum.com/t/nested-component-slots/56081/4 "2025-02-08T05:35:08Z")

</div>

I agree. I’d love to see nestable slots.
