# How to pass the value from pagemodel to a custom component

**URL:** <https://forum.builder.io/t/how-to-pass-the-value-from-pagemodel-to-a-custom-component/4284>\
**Category:** Visual Editor Help\
**Created:** [October 5, 2023, 2:05pm UTC](https://forum.builder.io/t/how-to-pass-the-value-from-pagemodel-to-a-custom-component/4284 "2023-10-05T14:05:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SelvaPrasath](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@SelvaPrasath](https://forum.builder.io/u/SelvaPrasath)\
**Post date:** [October 5, 2023, 2:05pm UTC](https://forum.builder.io/t/how-to-pass-the-value-from-pagemodel-to-a-custom-component/4284/1 "2023-10-05T14:05:14Z")

</div>

Say I have created a page model named “Sample” I have defined a list of attributes to be used in that model.  
In the content I am trying to use the “Sample” model by creating a page for it. how can I pass the value defined in the content to a custom component.

To give more idea on it  
This is my page content page for the page model

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/7/7973246463e973b85d8ec2a95c05b8c4cfee3d4b.jpeg)

Consider I need to pass the value of Section headline to customComponent named ButtonWithText  
How can I pass the value to the attribute of customComponent named title on ButtonWithText custom component.

 ![image](https://us1.discourse-cdn.com/flex020/uploads/builder/original/2X/7/7f80c3d97b45f9a6f710b807f8d2e43e7469c4f4.jpeg)

Could you please share any related documentations to achieve this.  
Thanks

---

<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:** [October 5, 2023, 2:28pm UTC](https://forum.builder.io/t/how-to-pass-the-value-from-pagemodel-to-a-custom-component/4284/2 "2023-10-05T14:28:07Z")

</div>

Hello @SelvaPrasath ,

You can pass [data](https://www.builder.io/c/docs/guides/connecting-api-data) and [functions](https://www.builder.io/c/docs/react/custom-actions) down to the Builder component to use in the UIs (e.g. bind data values to UIs e.g. for text values or iterating over lists, and actions to trigger for instance on click of a button)

All data passed down is available in Builder [actions and bindings](https://www.builder.io/c/docs/guides/custom-code) as `state.*`, for instance in the below example `state.products`, etc will be available

\<BuilderComponent model=“page” data={{ products: productsList, foo: ‘bar’, }} content={builderJson} /\>

Once you have the data available in builder UI, you can use the [dynamic data binding](https://www.builder.io/c/docs/guides/state-and-actions) feature to bind page data to your custom components.

> <https://github.com/BuilderIO/builder/tree/main/packages/react#passing-data-and-functions-down>
>
> //github.com/BuilderIO/builder/tree/main/packages/react

> [@Is it possible to access Page Fields in data bindings?](https://forum.builder.io/t/is-it-possible-to-access-page-fields-in-data-bindings/3393/4):
>
> Hi Jason, Ah yes! Apologies. You can bind to any custom field using context.builderContent For example, if you have a custom field called title, you’ll need to bind to context.builderContent.data.title So you can set state.someTitle = context.builderContent.data.title Basically, within custom JS I would recommend either setting the value to state by putting: state.whatever = context.builderContent.data.whatever Or, in your databinding you can access directly with context.builderContent.da…

---

<div class="post-metadata">

**Author:** ![SelvaPrasath](https://avatars.discourse-cdn.com/v4/letter/s/13edae/32.png) [@SelvaPrasath](https://forum.builder.io/u/SelvaPrasath)\
**Post date:** [October 5, 2023, 2:48pm UTC](https://forum.builder.io/t/how-to-pass-the-value-from-pagemodel-to-a-custom-component/4284/3 "2023-10-05T14:48:36Z")

</div>

Wow. That helped. But @manish-sharma by any chance can this be automated what I am trying to understand is that these data binding is quite technical to be added in the [builder.io](http://builder.io) for a content author. Instead can I automatically map the data to custom components whenever it is being created.
