ic-ui-kit icon indicating copy to clipboard operation
ic-ui-kit copied to clipboard

[ic-select-multiselect]: Display chips within IcSelect input value

Open jd239 opened this issue 1 year ago โ€ข 3 comments

Summary

When selecting multiple items from the dropdown list, the values within IcSelect appear as text. This ticket is to add a new feature which allows chips to appear within the IcSelect input.

๐Ÿ’ฌ Description

When selecting items from IcMenu, the selected values will appear as chips within the IcSelect input element. At the time of writing, this will only appear for the multi-select functionality. Selecting or deselecting the chips will add or remove the chip from the IcSelect input. Something to consider is if dismissible chips should be used. This will allow consumers to remove the value from a selected state without opening the IcMenu and then deselecting the option.

Things to consider

  • What happens when the number of chips do not fit in the IcSelect input space? Do they stack or not?
  • If the chips are not stacked, does the chip which is cut off by IcSelect appear truncated like the current text implementation?

image

๐Ÿ’ฐ User value

This adds flexibility to how values are displayed within the IcSelect. Also, displaying chips may be a better approach for displaying a particular type of data.

๐Ÿ“š User Stories

(To be completed after further exploration) If relevant, describe the high-level functionality as user stories.

As an ICDS user:
I need So that

๐Ÿ“ Acceptance Criteria

If relevant, describe in full detail the different interactions and edge cases that the component or patterns needs to fulfil.

Given that I have an IcSelect with no selected options When I select an option
Then the value should appear as a chip in IcSelect

Given that I have an IcSelect with x number of selected options When I deselect an option
Then the chip should be removed from IcSelect input

Given that I have an IcSelect with x number of selected options appearing as dismissible chips When I click the dismiss button on the chip
Then the chip should be removed from IcSelect input

Given that I have an IcSelect with x number of selected options appearing as dismissible chips When I click the dismiss button on the chip
Then the option should no longer have the selected state when opening the IcMenu

โœ Designs

If there's a Figma design file (or other mock-up), include it here.

##โ€ฏ๐Ÿงพ Guidance If there's written guidance or documentation, include a link to it here.

Additional info

Example:

  • MUI: https://mui.com/material-ui/react-select/#chip

jd239 avatar Sep 13 '24 09:09 jd239

Note to designers: use MUI example linked in Additional Info for inspiration, consider if we want to 'one up' them with dismissible chips

GCHQ-Developer-299 avatar Dec 19 '24 11:12 GCHQ-Developer-299

Would be potentially blocked from developing until https://github.com/mi6/ic-ui-kit/issues/3549 has been fixed

GCHQ-Developer-741 avatar May 16 '25 12:05 GCHQ-Developer-741

The requirement here isn't specifically to add chips inside a select component, it's more along the lines of; can we provide a mechanism for displaying selected values of a multiselect component when not expanded and provide the ability to remove selected values without opening the multiselect.

Placing chips inside a field may prove to be difficult for keyboard accessibility and focus states.

mi6-577 avatar Oct 15 '25 13:10 mi6-577