# What is the role of 'withBuilder()' function

**URL:** <https://forum.builder.io/t/what-is-the-role-of-withbuilder-function/6419>\
**Category:** Technical Questions\
**Tags:** api, react\
**Created:** [September 19, 2024, 9:43pm UTC](https://forum.builder.io/t/what-is-the-role-of-withbuilder-function/6419 "2024-09-19T21:43:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![soumya](https://avatars.discourse-cdn.com/v4/letter/s/ea5d25/32.png) [@soumya](https://forum.builder.io/u/soumya)\
**Post date:** [September 19, 2024, 9:43pm UTC](https://forum.builder.io/t/what-is-the-role-of-withbuilder-function/6419/1 "2024-09-19T21:43:23Z")

</div>

What is the role of ‘withBuilder()’ function?  
like what does this below code do?:

const Button = withBuilder(ButtonComponent, {  
name: ‘Core:Button’,  
image:  
‘[https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13](https://cdn.builder.io/api/v1/image/assets%2FIsxPKMo2gPRRKeakUztj1D6uqed2%2F81a15681c3e74df09677dfc57a615b13)’,  
defaultStyles: {  
…

---

<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:** [September 20, 2024, 9:43am UTC](https://forum.builder.io/t/what-is-the-role-of-withbuilder-function/6419/2 "2024-09-20T09:43:13Z")

</div>

Hello @soumya,

The `withBuilder` function is a Higher-Order Component (HOC) that registers your custom component with [Builder.io](http://Builder.io) by applying a `BuilderBlock` decorator. This process involves attaching meta-information from the `options` parameter to the component, enabling it to be managed and used within [Builder.io](http://Builder.io)’s Visual Editor.

To know more you can refer to the below links

1. [builder/packages/react/src/functions/with-builder.ts at main · BuilderIO/builder · GitHub](https://github.com/BuilderIO/builder/blob/main/packages/react/src/functions/with-builder.ts)
2. [Custom Components Setup](https://www.builder.io/c/docs/custom-components-setup)

Thanks,
