1e41f4b71Sopenharmony_ci# SymbolSpan
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciAs a child component of the **Text** component, the **SymbolSpan** component is used to display small icons.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>  **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> - This component is supported since API version 11. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci> - This component can inherit attribute settings from its parent component **Text**. This means that, if an attribute is not set in this component, it takes the value of the attribute (if set) from its parent component.
10e41f4b71Sopenharmony_ci>
11e41f4b71Sopenharmony_ci> - The **SymbolSpan** component is not dimmed when dragged.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci## Child Components
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciNot supported
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci## APIs
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciSymbolSpan(value: Resource)
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci**Parameters**
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
30e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
31e41f4b71Sopenharmony_ci| value | [Resource](ts-types.md#resource)| Yes| Resource of the **SymbolSpan** component, for example, **$r('sys.symbol.ohos_wifi')**.|
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci>  **NOTE**
34e41f4b71Sopenharmony_ci>
35e41f4b71Sopenharmony_ci>  The resources referenced in **$r('sys.symbol.ohos_wifi')** are preset in the system. The **SymbolSpan** component supports only the preset symbol resources. If unsupported resources are referenced, an exception occurs.
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci## Attributes
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciThe [universal attributes](ts-universal-attributes-size.md) are not supported. Only the following attributes are supported.
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci### fontColor
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_cifontColor(value: Array<ResourceColor>)
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ciSets the color of the symbol span.
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12.
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci**Parameters**
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci| Name| Type                                               | Mandatory| Description                                                        |
56e41f4b71Sopenharmony_ci| ------ | --------------------------------------------------- | ---- | ------------------------------------------------------------ |
57e41f4b71Sopenharmony_ci| value  | Array\<[ResourceColor](ts-types.md#resourcecolor)\> | Yes  | Color of the symbol span.<br> Default value: depending on the rendering strategy|
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ci### fontSize
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_cifontSize(value: number | string | Resource)
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ciSets the size of the symbol span.
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12.
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci**Parameters**
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_ci| Name| Type                                                        | Mandatory| Description                                         |
74e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | --------------------------------------------- |
75e41f4b71Sopenharmony_ci| value  | number \| string \| [Resource](ts-types.md#resource) | Yes  | Size of the symbol span.<br>Default value: system default value|
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci### fontWeight
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_cifontWeight(value: number | FontWeight | string)
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ciSets the weight of the symbol span. For the number type, the value ranges from 100 to 900, at an interval of 100. A larger value indicates a heavier font weight. The default value is **400**. For the string type, only strings of the number type are supported, for example, **"400"**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**.
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ciThe **sys.symbol.ohos_lungs** icon does not support font weight setting.
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12.
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ci**Parameters**
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci| Name| Type                                                        | Mandatory| Description                                              |
94e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | -------------------------------------------------- |
95e41f4b71Sopenharmony_ci| value  | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string | Yes  | Weight of the symbol span.<br>Default value: **FontWeight.Normal**|
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci### renderingStrategy
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_cirenderingStrategy(value: SymbolRenderingStrategy)
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ciSets the rendering strategy of the symbol span.
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12.
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ci**Parameters**
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci| Name| Type                                                        | Mandatory| Description                                                        |
112e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
113e41f4b71Sopenharmony_ci| value  | [SymbolRenderingStrategy](ts-basic-components-symbolGlyph.md#symbolrenderingstrategy11) | Yes  | Rendering strategy of the symbol span.<br>Default value: **SymbolRenderingStrategy.SINGLE**|
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ciThe figure below shows the effects of different rendering strategies.
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci![renderingStrategy](figures/renderingStrategy.png)
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci### effectStrategy
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_cieffectStrategy(value: SymbolEffectStrategy)
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ciSets the symbol effect of the symbol span.
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 12.
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci**Parameters**
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ci| Name| Type                                                        | Mandatory| Description                                                      |
134e41f4b71Sopenharmony_ci| ------ | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- |
135e41f4b71Sopenharmony_ci| value  | [SymbolEffectStrategy](ts-basic-components-symbolGlyph.md#symboleffectstrategy11) | Yes  | Symbol effect of the symbol span.<br>Default value: **SymbolEffectStrategy.NONE**|
136e41f4b71Sopenharmony_ci
137e41f4b71Sopenharmony_ci### attributeModifier<sup>12+</sup>
138e41f4b71Sopenharmony_ci
139e41f4b71Sopenharmony_ciattributeModifier(modifier: AttributeModifier\<SymbolSpanAttribute>)
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ciCreates an attribute modifier.
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ci**Parameters**
148e41f4b71Sopenharmony_ci
149e41f4b71Sopenharmony_ci| Name| Type                                               | Mandatory| Description                                                        |
150e41f4b71Sopenharmony_ci| ------ | --------------------------------------------------- | ---- | ------------------------------------------------------------ |
151e41f4b71Sopenharmony_ci| modifier  | [AttributeModifier](ts-universal-attributes-attribute-modifier.md#attributemodifiert)\<SymbolSpanAttribute> | Yes  | Modifier for dynamically setting attributes on the current component.|
152e41f4b71Sopenharmony_ci
153e41f4b71Sopenharmony_ci## Events
154e41f4b71Sopenharmony_ci
155e41f4b71Sopenharmony_ciThe [universal events](ts-universal-events-click.md) are not supported.
156e41f4b71Sopenharmony_ci
157e41f4b71Sopenharmony_ci## Example
158e41f4b71Sopenharmony_ci
159e41f4b71Sopenharmony_ci```ts
160e41f4b71Sopenharmony_ci// xxx.ets
161e41f4b71Sopenharmony_ci@Entry
162e41f4b71Sopenharmony_ci@Component
163e41f4b71Sopenharmony_cistruct Index {
164e41f4b71Sopenharmony_ci  build() {
165e41f4b71Sopenharmony_ci    Column() {
166e41f4b71Sopenharmony_ci      Row() {
167e41f4b71Sopenharmony_ci        Column() {
168e41f4b71Sopenharmony_ci          Text("Light")
169e41f4b71Sopenharmony_ci          Text() {
170e41f4b71Sopenharmony_ci            SymbolSpan($r('sys.symbol.ohos_trash'))
171e41f4b71Sopenharmony_ci              .fontWeight(FontWeight.Lighter)
172e41f4b71Sopenharmony_ci              .fontSize(96)
173e41f4b71Sopenharmony_ci          }
174e41f4b71Sopenharmony_ci        }
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_ci        Column() {
177e41f4b71Sopenharmony_ci          Text("Normal")
178e41f4b71Sopenharmony_ci          Text() {
179e41f4b71Sopenharmony_ci            SymbolSpan($r('sys.symbol.ohos_trash'))
180e41f4b71Sopenharmony_ci              .fontWeight(FontWeight.Normal)
181e41f4b71Sopenharmony_ci              .fontSize(96)
182e41f4b71Sopenharmony_ci          }
183e41f4b71Sopenharmony_ci        }
184e41f4b71Sopenharmony_ci
185e41f4b71Sopenharmony_ci        Column() {
186e41f4b71Sopenharmony_ci          Text("Bold")
187e41f4b71Sopenharmony_ci          Text() {
188e41f4b71Sopenharmony_ci            SymbolSpan($r('sys.symbol.ohos_trash'))
189e41f4b71Sopenharmony_ci              .fontWeight(FontWeight.Bold)
190e41f4b71Sopenharmony_ci              .fontSize(96)
191e41f4b71Sopenharmony_ci          }
192e41f4b71Sopenharmony_ci        }
193e41f4b71Sopenharmony_ci      }
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ci      Row() {
196e41f4b71Sopenharmony_ci        Column() {
197e41f4b71Sopenharmony_ci          Text ("Monochrome")
198e41f4b71Sopenharmony_ci          Text() {
199e41f4b71Sopenharmony_ci            SymbolSpan($r('sys.symbol.ohos_folder_badge_plus'))
200e41f4b71Sopenharmony_ci              .fontSize(96)
201e41f4b71Sopenharmony_ci              .renderingStrategy(SymbolRenderingStrategy.SINGLE)
202e41f4b71Sopenharmony_ci              .fontColor([Color.Black, Color.Green, Color.White])
203e41f4b71Sopenharmony_ci          }
204e41f4b71Sopenharmony_ci        }
205e41f4b71Sopenharmony_ci
206e41f4b71Sopenharmony_ci        Column() {
207e41f4b71Sopenharmony_ci          Text ("Multicolor")
208e41f4b71Sopenharmony_ci          Text() {
209e41f4b71Sopenharmony_ci            SymbolSpan($r('sys.symbol.ohos_folder_badge_plus'))
210e41f4b71Sopenharmony_ci              .fontSize(96)
211e41f4b71Sopenharmony_ci              .renderingStrategy(SymbolRenderingStrategy.MULTIPLE_COLOR)
212e41f4b71Sopenharmony_ci              .fontColor([Color.Black, Color.Green, Color.White])
213e41f4b71Sopenharmony_ci          }
214e41f4b71Sopenharmony_ci        }
215e41f4b71Sopenharmony_ci
216e41f4b71Sopenharmony_ci        Column() {
217e41f4b71Sopenharmony_ci          Text ("Multilayer")
218e41f4b71Sopenharmony_ci          Text() {
219e41f4b71Sopenharmony_ci            SymbolSpan($r('sys.symbol.ohos_folder_badge_plus'))
220e41f4b71Sopenharmony_ci              .fontSize(96)
221e41f4b71Sopenharmony_ci              .renderingStrategy(SymbolRenderingStrategy.MULTIPLE_OPACITY)
222e41f4b71Sopenharmony_ci              .fontColor([Color.Black, Color.Green, Color.White])
223e41f4b71Sopenharmony_ci          }
224e41f4b71Sopenharmony_ci        }
225e41f4b71Sopenharmony_ci      }
226e41f4b71Sopenharmony_ci
227e41f4b71Sopenharmony_ci      Row() {
228e41f4b71Sopenharmony_ci        Column() {
229e41f4b71Sopenharmony_ci          Text ("No effect")
230e41f4b71Sopenharmony_ci          Text() {
231e41f4b71Sopenharmony_ci            SymbolSpan($r('sys.symbol.ohos_wifi'))
232e41f4b71Sopenharmony_ci              .fontSize(96)
233e41f4b71Sopenharmony_ci              .effectStrategy(SymbolEffectStrategy.NONE)
234e41f4b71Sopenharmony_ci          }
235e41f4b71Sopenharmony_ci        }
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ci        Column() {
238e41f4b71Sopenharmony_ci          Text ("Overall scale effect")
239e41f4b71Sopenharmony_ci          Text() {
240e41f4b71Sopenharmony_ci            SymbolSpan($r('sys.symbol.ohos_wifi'))
241e41f4b71Sopenharmony_ci              .fontSize(96)
242e41f4b71Sopenharmony_ci              .effectStrategy(1)
243e41f4b71Sopenharmony_ci          }
244e41f4b71Sopenharmony_ci        }
245e41f4b71Sopenharmony_ci
246e41f4b71Sopenharmony_ci        Column() {
247e41f4b71Sopenharmony_ci          Text ("Hierarchical effect")
248e41f4b71Sopenharmony_ci          Text() {
249e41f4b71Sopenharmony_ci            SymbolSpan($r('sys.symbol.ohos_wifi'))
250e41f4b71Sopenharmony_ci              .fontSize(96)
251e41f4b71Sopenharmony_ci              .effectStrategy(2)
252e41f4b71Sopenharmony_ci          }
253e41f4b71Sopenharmony_ci        }
254e41f4b71Sopenharmony_ci      }
255e41f4b71Sopenharmony_ci    }
256e41f4b71Sopenharmony_ci  }
257e41f4b71Sopenharmony_ci}
258e41f4b71Sopenharmony_ci```
259e41f4b71Sopenharmony_ci![SymbolSpan](figures/symbolSpan.gif)
260