Update a component’s state using client state parameters
-
- UpdatedJan 30, 2025
- 5 minutes to read
- Yokohama
- Building applications
Create and bind a client state parameter value to a component in UI Builder. By adding custom values to your components, these components can then be automatically updated through a script.
Before you begin
Role required: ui_builder_admin
About this task
You can add two components to a page and then connect them by using client state parameters and scripts. Start by creating a client state parameter and then binding the client state parameter to one of the components, such as a label. Next, you create a client script and bind it to a second component, such as a button, using an event handler. When you create the event handler, bind the client state parameter value to it to connect the two components. If you click one component, it changes the state of the other component. Client states are useful because you can add custom values to your components that can be automatically updated through a script. Think of a client state as a bucket for storing information that is specific to the page.
For example, you can add a button and label component to your page. The button changes the value of the label, such as changing the text color.
Procedure
Result
What you did in this procedure:
- Added two components to your page.
- Defined a client state parameter that had an initial value.
- Bound the client state parameter to the first component.
- Created a client script that updates a value that is defined by the client state parameter.
- Created an event handler for the second component to call the new client script that you just created
- Selected the second component so that it changed the state of the first component.