We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

How to achieve accordion functionality in UI Builder

Vinay Tulabandu
Giga Guru

The accordion component is no longer present in servicenow UI Builder. To achieve this we need to create custom component. So, I have created a workaround that works similar to accordion.

 

Step 1 :  Create a container with heading and button as shown below, (can be any page or inside component)

 

Screenshot 2026-03-03 at 22.26.48.png

    Left side content panel looks like below,

Screenshot 2026-03-03 at 22.25.44.png

 

Step 2 :Create a client state parameter of type boolean. (I have created with name hide as shown below)

 

Screenshot 2026-03-03 at 22.31.01.png

 

In above screenshot, I selected intial value to true so that the address details will be collapsed by default.

 

Step 3 : Create another container below and add your content that needs to be inside accordion. In below screenshot you can see the address details that are part of it.

Screenshot 2026-03-03 at 22.29.34.png

Step 4 : Select the above container created and add a dynamic data binding to the component visibility as shown below,

Screenshot 2026-03-03 at 22.34.56.png

Step 5 : Select the button created in step 1 and configure the component as shown below,

Two things are added, one is to dynamically change the button icon and another is tool tip text based on the client state parameter created in step 2. so if client state parameter value is true, icon should be 'chevron-down-fill' and if value is false icon will be 'chevron-up-fill'. Similarly the tool tip text will be Expand if value is true and collapse if value is false.

 

Screenshot 2026-03-03 at 22.36.47.png

 

Step 6 : Go to events section for the same button and add an event to set client state parameter.

Screenshot 2026-03-03 at 22.41.37.png

If you notice in above image, the value is NOT(hide). so this works like toggle button.

So everytime user clicks, the client state parameter value changes.(from false to true or from) true to false. Using this parameter I am controlling the required container under it.

 

The final result looks as below screenshot.

 

Screenshot 2026-03-03 at 22.47.12.png

The intial value of client state parameter is set to true so you can see the tooltip text as expand and no container is opened.

 

And when user clicks on the button, it changes as shown below,

Screenshot 2026-03-03 at 22.48.15.png

1 ACCEPTED SOLUTION

Vinay Tulabandu
Giga Guru

This is more of article explaining the functionality so marking this accepted solution by myself

View solution in original post

1 REPLY 1

Vinay Tulabandu
Giga Guru

This is more of article explaining the functionality so marking this accepted solution by myself