# The "+ Add Block" button adds a block \*after\* the component instead of \*inside\* of it

**URL:** <https://forum.builder.io/t/the-add-block-button-adds-a-block-after-the-component-instead-of-inside-of-it/3581>\
**Category:** Bugs\
**Tags:** nextjs\
**Created:** [May 9, 2023, 1:05pm UTC](https://forum.builder.io/t/the-add-block-button-adds-a-block-after-the-component-instead-of-inside-of-it/3581 "2023-05-09T13:05:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![neri](https://avatars.discourse-cdn.com/v4/letter/n/da6949/32.png) [@neri](https://forum.builder.io/u/neri)\
**Post date:** [May 9, 2023, 1:05pm UTC](https://forum.builder.io/t/the-add-block-button-adds-a-block-after-the-component-instead-of-inside-of-it/3581/1 "2023-05-09T13:05:45Z")

</div>

**Issue:**  
I have a custom component which is empty as first, and receives children in it.  
I added a component in it so the user can click the “+ Add Block” button and add whichever block he wants inside my component.

what happens is that builder adds the block the user chooses _after_ the component instead of _inside_ of it.

**My stack:**  
Next.js

**My Code:**

```auto
export const MyComponent: React.FC<Props> = ({ children, ...props }) => {
  return (
    <div
      style={{
        width: "800px",
        height: "200px",
        display: "flex",
        alignItems: "center",
        justifyContent: "center",
        border: "1px solid #cccccc",
        color: "#cccccc",
      }}
    >
      <GlobalStyle />

      {Array.isArray(children) && children.length > 0 ? (
        React.Children.map(children, (child, index) => {
          return (
            <div
              style={{
                width: "200px",
                height: "200px",
              }}
              key={`${index}`}
            >
              {child}
            </div>
          );
        })
      ) : (
        <BuilderBlocks
          parentElementId={props.builderBlock.id}
          style={{
            width: "200px",
            height: "200px",
          }}
        />
      )}
    </div>
  );
};

const MyComponentWithChildren = withChildren(MyComponentWithChildren);

Builder.registerComponent(MyComponentWithChildren, {
  name: "MyComponentWithChildren",
  inputs: [],
});

```

**Video:**

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [May 9, 2023, 4:43pm UTC](https://forum.builder.io/t/the-add-block-button-adds-a-block-after-the-component-instead-of-inside-of-it/3581/2 "2023-05-09T16:43:36Z")

</div>

Hi @neri,

You may find help at our forum post [**How to Add Dynamic Editing Regions to Custom Components**](https://forum.builder.io/t/how-to-add-dynamic-editing-regions-to-custom-components/1323)

---

<div class="post-metadata">

**Author:** ![neri](https://avatars.discourse-cdn.com/v4/letter/n/da6949/32.png) [@neri](https://forum.builder.io/u/neri)\
**Post date:** [May 14, 2023, 12:20pm UTC](https://forum.builder.io/t/the-add-block-button-adds-a-block-after-the-component-instead-of-inside-of-it/3581/3 "2023-05-14T12:20:54Z")

</div>

Hi @manish-sharma this example doesn’t work for me
