Why Pill List doesn't contain Pill objects

mmorski
Tera Contributor

In UI Builder we have 2 similar components:
Pill: https://developer.servicenow.com/dev.do#!/reference/next-experience/xanadu/now-components/now-pill/u...
Pill List: https://developer.servicenow.com/dev.do#!/reference/next-experience/xanadu/shared-components/now-pil...

I need dynamic list of Pills (I never know how many Pills I need to display because this information is provided by REST response). And I need functionality like normal "Pill" has: 

  • Selected

    [selected]

    Indicates the selected state on default. If true, when the page is first opened, the user sees the toggle as selected or "on."
    Dismissible

    [canDismiss]

    Displays a button at the end of the pill, which is used to dispatch an action. For example, an (X) button can be provided so the user can select the button to remove the pill.

     

  • Event Description
    Pill selected setDispatched when the user toggles the selected status of the Pill. Set the manage-selected property to override the default behavior and handle this action manually.
    Pill dismissedDispatched when the user selects the pill dismiss button. The Pill component doesn't handle this action; its parent must handle it and remove the pill from its state so it's no longer rendered.

     

Why I can't configure those fields in "Pill List"? Is there any option to build component where I will provide by "Data Binding" array of objects and it will be an array of "Pills"? 

I have case when on the left side of page I have "List Selector" component with avaliable Filters and I want to add "Pills" above search result like this:

mmorski_0-1733490080017.png

And this list is dynamic.

1 ACCEPTED SOLUTION

Kevin83
ServiceNow Employee
ServiceNow Employee

I am not sure why the pill list component doesn't support what you want, but perhaps you can  work around the issue by using a repeater component to repeat over the list of pills instead?

View solution in original post

2 REPLIES 2

Kevin83
ServiceNow Employee
ServiceNow Employee

I am not sure why the pill list component doesn't support what you want, but perhaps you can  work around the issue by using a repeater component to repeat over the list of pills instead?

mmorski
Tera Contributor

Hi @Kevin83 and Thank You! This is exacly what I need I already implement my functionality. This "Repeater" component is super usefull.

mmorski_0-1733733387126.png