1e41f4b71Sopenharmony_ci# ChipGroup
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci**ChipGroup** is an advanced component that provides a group of chips for scenarios such as categorizing files or resource content.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> This component is supported since API version 12. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Child Components
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciNot supported
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci## ChipGroup
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci```
16e41f4b71Sopenharmony_ciChipGroup({
17e41f4b71Sopenharmony_ci  items: ChipGroupItemOptions[],
18e41f4b71Sopenharmony_ci  itemStyle?: ChipItemStyle,
19e41f4b71Sopenharmony_ci  selectedIndexes?: Array<number>,
20e41f4b71Sopenharmony_ci  multiple?: boolean,
21e41f4b71Sopenharmony_ci  chipGroupSpace?: ChipGroupSpaceOptions,
22e41f4b71Sopenharmony_ci  chipGroupPadding?: ChipGroupPaddingOptions,
23e41f4b71Sopenharmony_ci  onChange?: (selectedIndexes: Array<number>) => void,
24e41f4b71Sopenharmony_ci  suffix?: Callback<void>
25e41f4b71Sopenharmony_ci})
26e41f4b71Sopenharmony_ci```
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci**Decorator**: @Component
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci**Parameters**
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci| Name           | Type                                           | Mandatory| Description                                                                                      |
37e41f4b71Sopenharmony_ci| --------------- | ----------------------------------------------- | ---- | ------------------------------------------------------------                             |
38e41f4b71Sopenharmony_ci| items           | [ChipGroupItemOptions[]](#chipgroupitemoptions) | Yes  | Specific attributes of individual chips. For details, see [ChipGroupItemOptions[]](#chipgroupitemoptions).<br>If this parameter is set to **undefined**, the chip group is empty by default.              |
39e41f4b71Sopenharmony_ci| itemStyle       | [ChipItemStyle](#chipitemstyle)                 | No  | Chip style, including the color and size. For details, see [ChipItemStyle](#chipitemstyle).<br>If this parameter is set to **undefined**, the default chip style is used.                |
40e41f4b71Sopenharmony_ci| selectedIndexes | Array&lt;number&gt;                             | No  | Index of the selected chip.<br>If this parameter is set to **undefined**, the first chip is selected.                                           |
41e41f4b71Sopenharmony_ci| multiple        | boolean                                         | No  | Whether multiple chips can be selected.<br>**true**: Multiple chips can be selected.<br>**false**: Only one chip can be selected.<br>Default value: **false**<br>If this parameter is set to **undefined**, the default value is used.                    |
42e41f4b71Sopenharmony_ci| chipGroupSpace  | [ChipGroupSpaceOptions](#chipgroupspaceoptions) | No  | Left and right padding, and the spacing between chips. For details, see [ChipGroupSpaceOptions](#chipgroupspaceoptions).<br>If this parameter is set to **undefined**, the default value is used.|
43e41f4b71Sopenharmony_ci| chipGroupPadding  | [ChipGroupPaddingOptions](#chipgrouppaddingoptions) | No  | Top and bottom padding, used to control the overall height. For details, see [ChipGroupPaddingOptions](#chipgrouppaddingoptions).<br>If this parameter is set to **undefined**, the default value is used.|
44e41f4b71Sopenharmony_ci| onChange        | (selectedIndexes: Array&lt;number&gt;) => void  | No  | Callback invoked when the chip status changes.<br>If the value is **undefined**, the event is unbound.                                                               |
45e41f4b71Sopenharmony_ci| suffix          | ()=>void                                        | No  | Suffix, which is a builder customized by the user and requires importing the [IconGroupSuffix](#icongroupsuffix) API when used.<br>Default value: The suffix is not displayed if not passed.|
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci> **NOTE**
48e41f4b71Sopenharmony_ci>
49e41f4b71Sopenharmony_ci> 1. When **multiple** is set to **false**, if **selectedIndexes** is not passed in, the first chip is automatically selected by default. However, if the provided **selectedIndexes** includes multiple elements, the chip at the first index is selected by default.
50e41f4b71Sopenharmony_ci>
51e41f4b71Sopenharmony_ci> 2. For the **suffix** API to work, you must include the **IconGroupSuffix** API when implementing it. If no value is specified for **suffix**, no suffix will be displayed.
52e41f4b71Sopenharmony_ci>
53e41f4b71Sopenharmony_ci> 3. The icon fill colors, such as **fillColor** and **activedFillColor**, are set to be consistent with the font color (**fontColor**). To differentiate the icon colors from the font color, include **prefixSymbol** when you pass in [ChipGroupSpaceOptions](#chipgroupspaceoptions).
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci## ChipGroupItemOptions
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ciDefines the specific attributes of individual chips.
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci| Name        | Type                          | Mandatory| Description                               |
62e41f4b71Sopenharmony_ci| ----------   | ----------------------------- | ---- | ----------------------------------- |
63e41f4b71Sopenharmony_ci| prefixIcon   | [IconOptions](#iconoptions)   | No  | Prefix image icon of the chip.                  |
64e41f4b71Sopenharmony_ci| prefixSymbol | [ChipSymbolGlyphOptions](ohos-arkui-advanced-Chip.md#chipsymbolglyphoptions12) | No  | Prefix symbol glyph icon of the chip.            |
65e41f4b71Sopenharmony_ci| label        | [LabelOptions](#labeloptions) | Yes  | Text of the chip.                           |
66e41f4b71Sopenharmony_ci| suffixIcon   | [IconOptions](#iconoptions) | No  | Suffix image icon of the chip.                  |
67e41f4b71Sopenharmony_ci| suffixSymbol | [ChipSymbolGlyphOptions](ohos-arkui-advanced-Chip.md#chipsymbolglyphoptions12) | No  | Suffix symbol glyph icon of the chip.            |
68e41f4b71Sopenharmony_ci| allowClose   | boolean                       | No  | Whether to show the close icon.<br>Default value: **false** |
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci>**NOTE**
71e41f4b71Sopenharmony_ci>
72e41f4b71Sopenharmony_ci>If **suffixIcon** is specified, **allowClose** has no effect.
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci## ChipItemStyle
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ciDefines the common attributes shared by all chips in the chip group.
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci| Name                   | Type                                                             | Mandatory| Description                                                 |
81e41f4b71Sopenharmony_ci| ----------------------- | ----------------------                                           | ---- | -------------------------------                       |
82e41f4b71Sopenharmony_ci| size                    | [ChipSize](ohos-arkui-advanced-Chip.md#chipsize) \| [SizeOptions](ts-types.md#sizeoptions)  | No  | Chip size. To use this API, you must import the **ChipSize** type from the **Chip** component.<br>Default value: **ChipSize**: **ChipSize.NORMAL**<br> If this parameter is set to **undefined**, the default value is used. |
83e41f4b71Sopenharmony_ci| backgroundColor         | [ResourceColor](ts-types.md#resourcecolor)                       | No  | Background color of the chip.<br>Default value: **$r('sys.color.ohos_id_color_button_normal')**<br>If this parameter is set to **undefined**, the default value is used.                 |
84e41f4b71Sopenharmony_ci| fontColor               | [ResourceColor](ts-types.md#resourcecolor)                       | No  | Font color of the chip.<br>Default value: **$r('sys.color.ohos_id_color_text_primary')**<br>If this parameter is set to **undefined**, the default value is used.                   |
85e41f4b71Sopenharmony_ci| selectedFontColor       | [ResourceColor](ts-types.md#resourcecolor)                       | No  | Font color of the chip when it is activated or selected.<br>Default value: **$r('sys.color.ohos_id_color_text_primary_contrary')**<br>If this parameter is set to **undefined**, the default value is used.   |
86e41f4b71Sopenharmony_ci| selectedBackgroundColor | [ResourceColor](ts-types.md#resourcecolor)                       | No  | Background color of the chip when it is activated or selected.<br>Default value: **$r('sys.color.ohos_id_color_emphasize')**<br>If this parameter is set to **undefined**, the default value is used.               |
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci> **NOTE**
89e41f4b71Sopenharmony_ci>
90e41f4b71Sopenharmony_ci> 1. The size settings for chips can be of two types: (1) **ChipSize**, which conveniently offers two size options, **NORMAL** and **SMALL**; (2) **SizeOptions**.
91e41f4b71Sopenharmony_ci>
92e41f4b71Sopenharmony_ci> 2. If **undefined** is assigned to **backgroundColor** or **selectedBackgroundColor**, the default background color is used. If an invalid value is assigned, the background color is transparent.
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ci## ChipGroupSpaceOptions
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ciDefines the left and right padding of the chip group, and the spacing between chips.
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci| Name      | Type           | Mandatory| Description                                              |
101e41f4b71Sopenharmony_ci| ---------- | -------------- | ---- | ------------------------------------------------ |
102e41f4b71Sopenharmony_ci| itemSpace | string \| number  | No  | Spacing between chips. Percentage values are not supported.<br>Default value: **8**<br>Unit: vp<br>If this parameter is set to **undefined**, the default value is used.     |
103e41f4b71Sopenharmony_ci| startSpace | [Length](ts-types.md#length)         | No  | Left padding. Percentage values are not supported.<br>Default value: **16**<br>Unit: vp<br>If this parameter is set to **undefined**, the default value is used.               |
104e41f4b71Sopenharmony_ci| endSpace   | [Length](ts-types.md#length)         | No  | Right padding. Percentage values are not supported.<br>Default value: **16**<br>Unit: vp<br>If this parameter is set to **undefined**, the default value is used.|
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci## ChipGroupPaddingOptions
107e41f4b71Sopenharmony_ci
108e41f4b71Sopenharmony_ciDefines the top and bottom padding of the chip group, used to control the overall height.
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ci| Name  | Type           | Mandatory| Description                                                       |
113e41f4b71Sopenharmony_ci| ------ | -------------- | ---- | ------------------------------------------------            |
114e41f4b71Sopenharmony_ci| top    | [Length](ts-types.md#length)         | Yes  | Top padding. Percentage values are not supported.<br>Default value: **14**<br>If this parameter is set to **undefined**, the default value is used.       |
115e41f4b71Sopenharmony_ci| bottom | [Length](ts-types.md#length)         | Yes  | Bottom padding. Percentage values are not supported.<br>Default value: **14**<br>If this parameter is set to **undefined**, the default value is used.        |
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci## IconGroupSuffix
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci**Decorator**: @Component
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ci**Parameters**
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci| Name    | Type                   | Mandatory| Description                                                               |
128e41f4b71Sopenharmony_ci| -------- | ---------------------- | ---- | ----------------------------------------------|
129e41f4b71Sopenharmony_ci| items    | Array<[IconItemOptions](#iconitemoptions) \| [SymbolGlyphModifier](ts-universal-attributes-attribute-modifier.md)> | Yes  | Custom builder items.|
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci> **NOTE**
132e41f4b71Sopenharmony_ci>
133e41f4b71Sopenharmony_ci> With **SymbolGlyphModifier**, neither modifying the animation type with **symbolEffect** nor setting the effect strategy with **effectStrategy** is supported.
134e41f4b71Sopenharmony_ci>
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ci## IconItemOptions
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ciDefines the tail builder, which imposes limitations on the settings for the background size and color.
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci| Name    | Type                           | Mandatory| Description                                     |
143e41f4b71Sopenharmony_ci| -------- | --------------                 | ---- | ------------------------------           |
144e41f4b71Sopenharmony_ci| icon     | [IconOptions](#iconoptions)    | Yes  | Custom builder icon.                       |
145e41f4b71Sopenharmony_ci| action   | Callback\<void>        | Yes  | Callback of custom builder items.<br>If the value is **undefined**, the event is unbound.           |
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ci## IconOptions
148e41f4b71Sopenharmony_ci
149e41f4b71Sopenharmony_ciDefines the common attributes of icons.
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
152e41f4b71Sopenharmony_ci
153e41f4b71Sopenharmony_ci| Name| Type                                  | Mandatory| Description                                                        |
154e41f4b71Sopenharmony_ci| ---- | -------------------------------------- | ---- | ------------------------------------------------------------ |
155e41f4b71Sopenharmony_ci| src  | [ResourceStr](ts-types.md#resourcestr) | Yes  | Icon source, which can be a specific image path or an image reference.                                    |
156e41f4b71Sopenharmony_ci| size | [SizeOptions](ts-types.md#sizeoptions) | No  | Icon size. Percentage values are not supported.<br>When the chip size is **ChipSize.SMALL**, the default suffix is at {width: 16, height: 16}.<br>When the chip size is **ChipSize.NORMAL**, the default suffix is at {width: 24, height: 24}.<br> To dynamically change the size, you must use the [SymbolGlyphModifier](ts-universal-attributes-attribute-modifier.md) type when importing the [IconGroupSuffix](#icongroupsuffix) API.|
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci## LabelOptions
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ciDefines the common attributes of labels.
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ci| Name| Type  | Mandatory | Description    |
165e41f4b71Sopenharmony_ci| ---- | ------ | ---- | -------- |
166e41f4b71Sopenharmony_ci| text | string | Yes  | Text of the chip. |
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci## Example
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci### Example 1: Suffix Not Included
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ci```typescript
173e41f4b71Sopenharmony_ciimport { ChipSize, ChipGroup } from '@kit.ArkUI'
174e41f4b71Sopenharmony_ci
175e41f4b71Sopenharmony_ci@Entry
176e41f4b71Sopenharmony_ci@Preview
177e41f4b71Sopenharmony_ci@Component
178e41f4b71Sopenharmony_cistruct Index {
179e41f4b71Sopenharmony_ci  @State selected_index: Array<number> = [0, 1, 2, 3, 4, 5, 6]
180e41f4b71Sopenharmony_ci  build() {
181e41f4b71Sopenharmony_ci    Column() {
182e41f4b71Sopenharmony_ci      ChipGroup({
183e41f4b71Sopenharmony_ci        items: [
184e41f4b71Sopenharmony_ci          {
185e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('app.media.icon') },
186e41f4b71Sopenharmony_ci            label: { text: "Chip 1" },
187e41f4b71Sopenharmony_ci            suffixIcon: { src: $r('sys.media.ohos_ic_public_cut') },
188e41f4b71Sopenharmony_ci            allowClose: false
189e41f4b71Sopenharmony_ci          },
190e41f4b71Sopenharmony_ci          {
191e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_copy') },
192e41f4b71Sopenharmony_ci            label: { text: "Chip 2" },
193e41f4b71Sopenharmony_ci            allowClose: true
194e41f4b71Sopenharmony_ci          },
195e41f4b71Sopenharmony_ci          {
196e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_clock') },
197e41f4b71Sopenharmony_ci            label: { text: "Chip 3" },
198e41f4b71Sopenharmony_ci            allowClose: true
199e41f4b71Sopenharmony_ci          },
200e41f4b71Sopenharmony_ci          {
201e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_cast_stream') },
202e41f4b71Sopenharmony_ci            label: { text: "Chip 4" },
203e41f4b71Sopenharmony_ci            allowClose: true
204e41f4b71Sopenharmony_ci          },
205e41f4b71Sopenharmony_ci          {
206e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_cast_mirror') },
207e41f4b71Sopenharmony_ci            label: { text: "Chip 5" },
208e41f4b71Sopenharmony_ci            allowClose: true
209e41f4b71Sopenharmony_ci          },
210e41f4b71Sopenharmony_ci          {
211e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_cast_stream') },
212e41f4b71Sopenharmony_ci            label: { text: "Chip 6" },
213e41f4b71Sopenharmony_ci            allowClose: true
214e41f4b71Sopenharmony_ci          },
215e41f4b71Sopenharmony_ci        ],
216e41f4b71Sopenharmony_ci        itemStyle: {
217e41f4b71Sopenharmony_ci          size: ChipSize.SMALL,
218e41f4b71Sopenharmony_ci          backgroundColor: $r('sys.color.ohos_id_color_button_normal'),
219e41f4b71Sopenharmony_ci          fontColor: $r('sys.color.ohos_id_color_text_primary'),
220e41f4b71Sopenharmony_ci          selectedBackgroundColor: $r('sys.color.ohos_id_color_emphasize'),
221e41f4b71Sopenharmony_ci          selectedFontColor: $r('sys.color.ohos_id_color_text_primary_contrary'),
222e41f4b71Sopenharmony_ci        },
223e41f4b71Sopenharmony_ci        selectedIndexes: this.selected_index,
224e41f4b71Sopenharmony_ci        multiple: false,
225e41f4b71Sopenharmony_ci        chipGroupSpace: { itemSpace: 8, endSpace: 0 },
226e41f4b71Sopenharmony_ci        chipGroupPadding: { top: 10, bottom: 10 },
227e41f4b71Sopenharmony_ci        onChange: (activatedChipsIndex:Array<number>) => {
228e41f4b71Sopenharmony_ci          console.log('chips on clicked, activated index ' + activatedChipsIndex)
229e41f4b71Sopenharmony_ci        },
230e41f4b71Sopenharmony_ci      })
231e41f4b71Sopenharmony_ci    }
232e41f4b71Sopenharmony_ci  }
233e41f4b71Sopenharmony_ci}
234e41f4b71Sopenharmony_ci```
235e41f4b71Sopenharmony_ci
236e41f4b71Sopenharmony_ci![](figures/chipGroupDemo1.jpeg)
237e41f4b71Sopenharmony_ci
238e41f4b71Sopenharmony_ci### Example 2: Suffix Included
239e41f4b71Sopenharmony_ci
240e41f4b71Sopenharmony_ci```typescript
241e41f4b71Sopenharmony_ciimport { ChipSize, ChipGroup, IconGroupSuffix  } from '@kit.ArkUI'
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci@Entry
244e41f4b71Sopenharmony_ci@Preview
245e41f4b71Sopenharmony_ci@Component
246e41f4b71Sopenharmony_cistruct Index {
247e41f4b71Sopenharmony_ci  @State selected_index: Array<number> = [0, 1, 2, 3, 4, 5, 6]
248e41f4b71Sopenharmony_ci  @State selected_state: boolean = true;
249e41f4b71Sopenharmony_ci
250e41f4b71Sopenharmony_ci  @LocalBuilder
251e41f4b71Sopenharmony_ci  ChipGroupSuffix(): void {
252e41f4b71Sopenharmony_ci    IconGroupSuffix({
253e41f4b71Sopenharmony_ci      items: [{
254e41f4b71Sopenharmony_ci        icon: { src: $r('sys.media.ohos_ic_public_search_filled'), size: { width: 36, height: 36 } },
255e41f4b71Sopenharmony_ci        action: () => {
256e41f4b71Sopenharmony_ci          if (this.selected_state == false) {
257e41f4b71Sopenharmony_ci            this.selected_index = [0, 1, 2, 3, 4, 5, 6]
258e41f4b71Sopenharmony_ci            this.selected_state = true
259e41f4b71Sopenharmony_ci          } else {
260e41f4b71Sopenharmony_ci            this.selected_index = []
261e41f4b71Sopenharmony_ci            this.selected_state = false
262e41f4b71Sopenharmony_ci          }
263e41f4b71Sopenharmony_ci        }
264e41f4b71Sopenharmony_ci      }
265e41f4b71Sopenharmony_ci      ]
266e41f4b71Sopenharmony_ci    })
267e41f4b71Sopenharmony_ci  }
268e41f4b71Sopenharmony_ci
269e41f4b71Sopenharmony_ci  build() {
270e41f4b71Sopenharmony_ci    Column() {
271e41f4b71Sopenharmony_ci      ChipGroup({
272e41f4b71Sopenharmony_ci        items: [
273e41f4b71Sopenharmony_ci          {
274e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('app.media.icon') },
275e41f4b71Sopenharmony_ci            label: { text: "Chip 1" },
276e41f4b71Sopenharmony_ci            suffixIcon: { src: $r('sys.media.ohos_ic_public_cut') },
277e41f4b71Sopenharmony_ci            allowClose: false
278e41f4b71Sopenharmony_ci          },
279e41f4b71Sopenharmony_ci          {
280e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_copy') },
281e41f4b71Sopenharmony_ci            label: { text: "Chip 2" },
282e41f4b71Sopenharmony_ci            allowClose: true
283e41f4b71Sopenharmony_ci          },
284e41f4b71Sopenharmony_ci          {
285e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_clock') },
286e41f4b71Sopenharmony_ci            label: { text: "Chip 3" },
287e41f4b71Sopenharmony_ci            allowClose: true
288e41f4b71Sopenharmony_ci          },
289e41f4b71Sopenharmony_ci          {
290e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_cast_stream') },
291e41f4b71Sopenharmony_ci            label: { text: "Chip 4" },
292e41f4b71Sopenharmony_ci            allowClose: true
293e41f4b71Sopenharmony_ci          },
294e41f4b71Sopenharmony_ci          {
295e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_cast_mirror') },
296e41f4b71Sopenharmony_ci            label: { text: "Chip 5" },
297e41f4b71Sopenharmony_ci            allowClose: true
298e41f4b71Sopenharmony_ci          },
299e41f4b71Sopenharmony_ci          {
300e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_cast_stream') },
301e41f4b71Sopenharmony_ci            label: { text: "Chip 6" },
302e41f4b71Sopenharmony_ci            allowClose: true
303e41f4b71Sopenharmony_ci          },
304e41f4b71Sopenharmony_ci        ],
305e41f4b71Sopenharmony_ci        itemStyle: {
306e41f4b71Sopenharmony_ci          size: ChipSize.NORMAL,
307e41f4b71Sopenharmony_ci          backgroundColor: $r('sys.color.ohos_id_color_button_normal'),
308e41f4b71Sopenharmony_ci          fontColor: $r('sys.color.ohos_id_color_text_primary'),
309e41f4b71Sopenharmony_ci          selectedBackgroundColor: $r('sys.color.ohos_id_color_emphasize'),
310e41f4b71Sopenharmony_ci          selectedFontColor: $r('sys.color.ohos_id_color_text_primary_contrary'),
311e41f4b71Sopenharmony_ci        },
312e41f4b71Sopenharmony_ci        selectedIndexes: this.selected_index,
313e41f4b71Sopenharmony_ci        multiple: true,
314e41f4b71Sopenharmony_ci        chipGroupSpace: { itemSpace: 8, endSpace: 0 },
315e41f4b71Sopenharmony_ci        chipGroupPadding: { top: 10, bottom: 10 },
316e41f4b71Sopenharmony_ci        onChange: (activatedChipsIndex: Array<number>) => {
317e41f4b71Sopenharmony_ci          console.log('chips on clicked, activated index ' + activatedChipsIndex)
318e41f4b71Sopenharmony_ci        },
319e41f4b71Sopenharmony_ci        suffix: this.ChipGroupSuffix
320e41f4b71Sopenharmony_ci      })
321e41f4b71Sopenharmony_ci    }
322e41f4b71Sopenharmony_ci  }
323e41f4b71Sopenharmony_ci}
324e41f4b71Sopenharmony_ci```
325e41f4b71Sopenharmony_ci
326e41f4b71Sopenharmony_ci![](figures/chipGroupDemo2.jpeg)
327e41f4b71Sopenharmony_ci
328e41f4b71Sopenharmony_ci### Example 3
329e41f4b71Sopenharmony_ciThis example implements **IconGroupSuffix** and **ChipGroup** with **SymbolGlyph** resources.
330e41f4b71Sopenharmony_ci```typescript
331e41f4b71Sopenharmony_ciimport { ChipSize, ChipGroup, IconGroupSuffix, SymbolGlyphModifier } from '@kit.ArkUI'
332e41f4b71Sopenharmony_ci
333e41f4b71Sopenharmony_ci@Entry
334e41f4b71Sopenharmony_ci@Preview
335e41f4b71Sopenharmony_ci@Component
336e41f4b71Sopenharmony_cistruct Index {
337e41f4b71Sopenharmony_ci  @State selected_index: Array<number> = [0, 1, 2, 3, 4, 5, 6];
338e41f4b71Sopenharmony_ci  @State selected_state: boolean = true;
339e41f4b71Sopenharmony_ci  @State prefixModifierNormal: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_star'));
340e41f4b71Sopenharmony_ci  @State prefixModifierActivated: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_star')).fontColor([Color.Red]);
341e41f4b71Sopenharmony_ci  @State suffixModifierNormal: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_wifi'));
342e41f4b71Sopenharmony_ci  @State suffixModifierActivated: SymbolGlyphModifier = new SymbolGlyphModifier($r('sys.symbol.ohos_wifi')).fontColor([Color.Red]);
343e41f4b71Sopenharmony_ci
344e41f4b71Sopenharmony_ci  @LocalBuilder
345e41f4b71Sopenharmony_ci  ChipGroupSuffix(): void {
346e41f4b71Sopenharmony_ci    IconGroupSuffix({
347e41f4b71Sopenharmony_ci      items: [
348e41f4b71Sopenharmony_ci        new SymbolGlyphModifier($r('sys.symbol.magnifyingglass'))
349e41f4b71Sopenharmony_ci          .onClick(() => {
350e41f4b71Sopenharmony_ci            if (this.selected_state == false) {
351e41f4b71Sopenharmony_ci              this.selected_index = [0, 1, 2, 3, 4, 5, 6];
352e41f4b71Sopenharmony_ci              this.selected_state = true;
353e41f4b71Sopenharmony_ci            } else {
354e41f4b71Sopenharmony_ci              this.selected_index = [];
355e41f4b71Sopenharmony_ci              this.selected_state = false;
356e41f4b71Sopenharmony_ci            }
357e41f4b71Sopenharmony_ci          })
358e41f4b71Sopenharmony_ci      ]
359e41f4b71Sopenharmony_ci    })
360e41f4b71Sopenharmony_ci  }
361e41f4b71Sopenharmony_ci
362e41f4b71Sopenharmony_ci  build() {
363e41f4b71Sopenharmony_ci    Column() {
364e41f4b71Sopenharmony_ci      ChipGroup({
365e41f4b71Sopenharmony_ci        items: [
366e41f4b71Sopenharmony_ci          {
367e41f4b71Sopenharmony_ci            prefixSymbol: { normal: this.prefixModifierNormal, activated: this.prefixModifierActivated },
368e41f4b71Sopenharmony_ci            label: { text: "Chip 1" },
369e41f4b71Sopenharmony_ci            suffixSymbol: { normal: this.suffixModifierNormal, activated: this.suffixModifierActivated },
370e41f4b71Sopenharmony_ci            allowClose: false,
371e41f4b71Sopenharmony_ci          },
372e41f4b71Sopenharmony_ci          {
373e41f4b71Sopenharmony_ci            prefixSymbol: { normal: this.prefixModifierNormal, activated: this.prefixModifierActivated },
374e41f4b71Sopenharmony_ci            label: { text: "Chip 2" },
375e41f4b71Sopenharmony_ci            allowClose: true,
376e41f4b71Sopenharmony_ci          },
377e41f4b71Sopenharmony_ci          {
378e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_clock') },
379e41f4b71Sopenharmony_ci            label: { text: "Chip 3" },
380e41f4b71Sopenharmony_ci            allowClose: true,
381e41f4b71Sopenharmony_ci          },
382e41f4b71Sopenharmony_ci          {
383e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_cast_stream') },
384e41f4b71Sopenharmony_ci            label: { text: "Chip 4" },
385e41f4b71Sopenharmony_ci            allowClose: true,
386e41f4b71Sopenharmony_ci          },
387e41f4b71Sopenharmony_ci          {
388e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_cast_mirror') },
389e41f4b71Sopenharmony_ci            label: { text: "Chip 5" },
390e41f4b71Sopenharmony_ci            allowClose: true,
391e41f4b71Sopenharmony_ci          },
392e41f4b71Sopenharmony_ci          {
393e41f4b71Sopenharmony_ci            prefixIcon: { src: $r('sys.media.ohos_ic_public_cast_stream') },
394e41f4b71Sopenharmony_ci            label: { text: "Chip 6" },
395e41f4b71Sopenharmony_ci            allowClose: true,
396e41f4b71Sopenharmony_ci          },
397e41f4b71Sopenharmony_ci        ],
398e41f4b71Sopenharmony_ci        itemStyle: {
399e41f4b71Sopenharmony_ci          size: ChipSize.NORMAL,
400e41f4b71Sopenharmony_ci          backgroundColor: $r('sys.color.ohos_id_color_button_normal'),
401e41f4b71Sopenharmony_ci          fontColor: $r('sys.color.ohos_id_color_text_primary'),
402e41f4b71Sopenharmony_ci          selectedBackgroundColor: $r('sys.color.ohos_id_color_emphasize'),
403e41f4b71Sopenharmony_ci          selectedFontColor: $r('sys.color.ohos_id_color_text_primary_contrary'),
404e41f4b71Sopenharmony_ci        },
405e41f4b71Sopenharmony_ci        selectedIndexes: this.selected_index,
406e41f4b71Sopenharmony_ci        multiple: true,
407e41f4b71Sopenharmony_ci        chipGroupSpace: { itemSpace: 8, endSpace: 0 },
408e41f4b71Sopenharmony_ci        chipGroupPadding: { top: 10, bottom: 10 },
409e41f4b71Sopenharmony_ci        onChange: (activatedChipsIndex: Array<number>) => {
410e41f4b71Sopenharmony_ci          console.log('chips on clicked, activated index ' + activatedChipsIndex)
411e41f4b71Sopenharmony_ci        },
412e41f4b71Sopenharmony_ci        suffix: this.ChipGroupSuffix
413e41f4b71Sopenharmony_ci      })
414e41f4b71Sopenharmony_ci    }
415e41f4b71Sopenharmony_ci  }
416e41f4b71Sopenharmony_ci}
417e41f4b71Sopenharmony_ci
418e41f4b71Sopenharmony_ci```
419e41f4b71Sopenharmony_ci![](figures/chipGroupDemo3.jpeg)
420