1e41f4b71Sopenharmony_ci# Text Display (Text/Span) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ciThe **\<Text>** component is used to display a piece of textual information. For details, see [Text](../reference/apis-arkui/arkui-ts/ts-basic-components-text.md). 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci## Creating Text 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ciYou can create text in either of the following ways: 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci- Entering strings 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci ```ts 15e41f4b71Sopenharmony_ci Text ('I am a piece of text') 16e41f4b71Sopenharmony_ci ``` 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci- Referencing Resource objects 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci You can use **$r** to create a **Resource** object to reference resources in **/resources/base/element/string.json**. 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci ```ts 28e41f4b71Sopenharmony_ci Text($r('app.string.module_desc')) 29e41f4b71Sopenharmony_ci .baselineOffset(0) 30e41f4b71Sopenharmony_ci .fontSize(30) 31e41f4b71Sopenharmony_ci .border({ width: 1 }) 32e41f4b71Sopenharmony_ci .padding(10) 33e41f4b71Sopenharmony_ci .width(300) 34e41f4b71Sopenharmony_ci ``` 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ci  37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci## Adding Child Components 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ciThe [\<Span>](../reference/apis-arkui/arkui-ts/ts-basic-components-span.md) component can only act as a child of the [\<Text>](../reference/apis-arkui/arkui-ts/ts-basic-components-text.md) and [\<RichEditor>](../reference/apis-arkui/arkui-ts/ts-basic-components-richeditor.md) components. You can add one or more **\<Span>** child components to a **\<Text>** component to display a piece of information, such as the product description and statement of commitment. 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci- Creating a \<Span> Component 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci The **\<Span>** component works only when included in a **\<Text>** component. If both the **\<Span>** and **\<Text>** components have text configured, the text of the **\<Span>** overwrites that of the **\<Text>** component. 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci ```ts 49e41f4b71Sopenharmony_ci Text (' I'm Text') { 50e41f4b71Sopenharmony_ci Span (' I'm Span') 51e41f4b71Sopenharmony_ci } 52e41f4b71Sopenharmony_ci .padding(10) 53e41f4b71Sopenharmony_ci .borderWidth(1) 54e41f4b71Sopenharmony_ci ``` 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci  57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci- Set the text decorative line. 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ci Use the **decoration** attribute to set the style and color of the text decorative line. 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci ```ts 64e41f4b71Sopenharmony_ci Text() { 65e41f4b71Sopenharmony_ci Span('I'm Span1,') .fontSize (16).fontColor (Color.Grey) 66e41f4b71Sopenharmony_ci .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }) 67e41f4b71Sopenharmony_ci Span('I'm Span2').fontColor (Color.Blue).fontSize (16) 68e41f4b71Sopenharmony_ci .fontStyle(FontStyle.Italic) 69e41f4b71Sopenharmony_ci .decoration({ type: TextDecorationType.Underline, color: Color.Black }) 70e41f4b71Sopenharmony_ci Span('I'm Span3').fontSize(16).fontColor(Color.Grey) 71e41f4b71Sopenharmony_ci .decoration({ type: TextDecorationType.Overline, color: Color.Green }) 72e41f4b71Sopenharmony_ci } 73e41f4b71Sopenharmony_ci .borderWidth(1) 74e41f4b71Sopenharmony_ci .padding(10) 75e41f4b71Sopenharmony_ci ``` 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ci  78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci- Use the **textCase** attribute to set the text case. 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci ```ts 82e41f4b71Sopenharmony_ci Text() { 83e41f4b71Sopenharmony_ci Span('I am Upper-span').fontSize(12) 84e41f4b71Sopenharmony_ci .textCase(TextCase.UpperCase) 85e41f4b71Sopenharmony_ci } 86e41f4b71Sopenharmony_ci .borderWidth(1) 87e41f4b71Sopenharmony_ci .padding(10) 88e41f4b71Sopenharmony_ci ``` 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ci  91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci- Adding Events 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci The **\<Span>** component does not have size information. Therefore, only an **onClick** event can be added for this component. 95e41f4b71Sopenharmony_ci 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ci ```ts 98e41f4b71Sopenharmony_ci Text() { 99e41f4b71Sopenharmony_ci Span('I am Upper-span').fontSize(12) 100e41f4b71Sopenharmony_ci .textCase(TextCase.UpperCase) 101e41f4b71Sopenharmony_ci .onClick(()=>{ 102e41f4b71Sopenharmony_ci console.info ('I'm Span - onClick') 103e41f4b71Sopenharmony_ci }) 104e41f4b71Sopenharmony_ci } 105e41f4b71Sopenharmony_ci ``` 106e41f4b71Sopenharmony_ci 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci## Setting Styles 109e41f4b71Sopenharmony_ci 110e41f4b71Sopenharmony_ci- Use the **textAlign** attribute to set the alignment mode of text. 111e41f4b71Sopenharmony_ci 112e41f4b71Sopenharmony_ci ```ts 113e41f4b71Sopenharmony_ci Text('Left aligned') 114e41f4b71Sopenharmony_ci .width(300) 115e41f4b71Sopenharmony_ci .textAlign(TextAlign.Start) 116e41f4b71Sopenharmony_ci .border({ width: 1 }) 117e41f4b71Sopenharmony_ci .padding(10) 118e41f4b71Sopenharmony_ci Text ('Center aligned') 119e41f4b71Sopenharmony_ci .width(300) 120e41f4b71Sopenharmony_ci .textAlign(TextAlign.Center) 121e41f4b71Sopenharmony_ci .border({ width: 1 }) 122e41f4b71Sopenharmony_ci .padding(10) 123e41f4b71Sopenharmony_ci Text('Right aligned') 124e41f4b71Sopenharmony_ci .width(300) 125e41f4b71Sopenharmony_ci .textAlign(TextAlign.End) 126e41f4b71Sopenharmony_ci .border({ width: 1 }) 127e41f4b71Sopenharmony_ci .padding(10) 128e41f4b71Sopenharmony_ci ``` 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci  131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci- Use the **textOverflow** attribute to set the display mode for when the text is too long. This attribute must be used together with **maxLines**. By default, the text is automatically folded. 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ci ```ts 135e41f4b71Sopenharmony_ci Text('This is the setting of textOverflow to Clip text content This is the setting of textOverflow to None text content. This is the setting of textOverflow to Clip text content This is the setting of textOverflow to None text content.') 136e41f4b71Sopenharmony_ci .width(250) 137e41f4b71Sopenharmony_ci .textOverflow({ overflow: TextOverflow.None }) 138e41f4b71Sopenharmony_ci .maxLines(1) 139e41f4b71Sopenharmony_ci .fontSize(12) 140e41f4b71Sopenharmony_ci .border({ width: 1 }) 141e41f4b71Sopenharmony_ci .padding(10) 142e41f4b71Sopenharmony_ci Text('I am extra long text, with an ellipse displayed for any excess.') 143e41f4b71Sopenharmony_ci .width(250) 144e41f4b71Sopenharmony_ci .textOverflow({ overflow: TextOverflow.Ellipsis }) 145e41f4b71Sopenharmony_ci .maxLines(1) 146e41f4b71Sopenharmony_ci .fontSize(12) 147e41f4b71Sopenharmony_ci .border({ width: 1 }) 148e41f4b71Sopenharmony_ci .padding(10) 149e41f4b71Sopenharmony_ci Text ('When the text overflows the container, it scrolls.') 150e41f4b71Sopenharmony_ci .width(250) 151e41f4b71Sopenharmony_ci .textOverflow({ overflow: TextOverflow.MARQUEE }) 152e41f4b71Sopenharmony_ci .maxLines(1) 153e41f4b71Sopenharmony_ci .fontSize(12) 154e41f4b71Sopenharmony_ci .border({ width: 1 }) 155e41f4b71Sopenharmony_ci .padding(10) 156e41f4b71Sopenharmony_ci ``` 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci  159e41f4b71Sopenharmony_ci 160e41f4b71Sopenharmony_ci- Use the **lineHeight** attribute to set the text line height. 161e41f4b71Sopenharmony_ci 162e41f4b71Sopenharmony_ci ```ts 163e41f4b71Sopenharmony_ci Text('This is the text with the line height set. This is the text with the line height set.') 164e41f4b71Sopenharmony_ci .width(300).fontSize(12).border({ width: 1 }).padding(10) 165e41f4b71Sopenharmony_ci Text('This is the text with the line height set. This is the text with the line height set.') 166e41f4b71Sopenharmony_ci .width(300).fontSize(12).border({ width: 1 }).padding(10) 167e41f4b71Sopenharmony_ci .lineHeight(20) 168e41f4b71Sopenharmony_ci ``` 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ci  171e41f4b71Sopenharmony_ci 172e41f4b71Sopenharmony_ci- Use the **decoration** attribute to set the style and color of the text decorative line. 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_ci ```ts 175e41f4b71Sopenharmony_ci Text('This is the text') 176e41f4b71Sopenharmony_ci .decoration({ 177e41f4b71Sopenharmony_ci type: TextDecorationType.LineThrough, 178e41f4b71Sopenharmony_ci color: Color.Red 179e41f4b71Sopenharmony_ci }) 180e41f4b71Sopenharmony_ci .borderWidth(1).padding(10).margin(5) 181e41f4b71Sopenharmony_ci Text('This is the text') 182e41f4b71Sopenharmony_ci .decoration({ 183e41f4b71Sopenharmony_ci type: TextDecorationType.Overline, 184e41f4b71Sopenharmony_ci color: Color.Red 185e41f4b71Sopenharmony_ci }) 186e41f4b71Sopenharmony_ci .borderWidth(1).padding(10).margin(5) 187e41f4b71Sopenharmony_ci Text('This is the text') 188e41f4b71Sopenharmony_ci .decoration({ 189e41f4b71Sopenharmony_ci type: TextDecorationType.Underline, 190e41f4b71Sopenharmony_ci color: Color.Red 191e41f4b71Sopenharmony_ci }) 192e41f4b71Sopenharmony_ci .borderWidth(1).padding(10).margin(5) 193e41f4b71Sopenharmony_ci ``` 194e41f4b71Sopenharmony_ci 195e41f4b71Sopenharmony_ci  196e41f4b71Sopenharmony_ci 197e41f4b71Sopenharmony_ci- Use the **baselineOffset** attribute to set the baseline offset of the text. 198e41f4b71Sopenharmony_ci 199e41f4b71Sopenharmony_ci ```ts 200e41f4b71Sopenharmony_ci Text('This is the text content with baselineOffset 0.') 201e41f4b71Sopenharmony_ci .baselineOffset(0) 202e41f4b71Sopenharmony_ci .fontSize(12) 203e41f4b71Sopenharmony_ci .border({ width: 1 }) 204e41f4b71Sopenharmony_ci .padding(10) 205e41f4b71Sopenharmony_ci .width('100%') 206e41f4b71Sopenharmony_ci .margin(5) 207e41f4b71Sopenharmony_ci Text('This is the text content with baselineOffset 30.') 208e41f4b71Sopenharmony_ci .baselineOffset(30) 209e41f4b71Sopenharmony_ci .fontSize(12) 210e41f4b71Sopenharmony_ci .border({ width: 1 }) 211e41f4b71Sopenharmony_ci .padding(10) 212e41f4b71Sopenharmony_ci .width('100%') 213e41f4b71Sopenharmony_ci .margin(5) 214e41f4b71Sopenharmony_ci 215e41f4b71Sopenharmony_ci Text('This is the text content with baselineOffset -20.') 216e41f4b71Sopenharmony_ci .baselineOffset(-20) 217e41f4b71Sopenharmony_ci .fontSize(12) 218e41f4b71Sopenharmony_ci .border({ width: 1 }) 219e41f4b71Sopenharmony_ci .padding(10) 220e41f4b71Sopenharmony_ci .width('100%') 221e41f4b71Sopenharmony_ci .margin(5) 222e41f4b71Sopenharmony_ci ``` 223e41f4b71Sopenharmony_ci 224e41f4b71Sopenharmony_ci  225e41f4b71Sopenharmony_ci 226e41f4b71Sopenharmony_ci- Use the **letterSpacing** attribute to set the letter spacing. 227e41f4b71Sopenharmony_ci 228e41f4b71Sopenharmony_ci ```ts 229e41f4b71Sopenharmony_ci Text('This is the text content with letterSpacing 0.') 230e41f4b71Sopenharmony_ci .letterSpacing(0) 231e41f4b71Sopenharmony_ci .fontSize(12) 232e41f4b71Sopenharmony_ci .border({ width: 1 }) 233e41f4b71Sopenharmony_ci .padding(10) 234e41f4b71Sopenharmony_ci .width('100%') 235e41f4b71Sopenharmony_ci .margin(5) 236e41f4b71Sopenharmony_ci Text('This is the text content with letterSpacing 3.') 237e41f4b71Sopenharmony_ci .letterSpacing(3) 238e41f4b71Sopenharmony_ci .fontSize(12) 239e41f4b71Sopenharmony_ci .border({ width: 1 }) 240e41f4b71Sopenharmony_ci .padding(10) 241e41f4b71Sopenharmony_ci .width('100%') 242e41f4b71Sopenharmony_ci .margin(5) 243e41f4b71Sopenharmony_ci Text('This is the text content with letterSpacing -1.') 244e41f4b71Sopenharmony_ci .letterSpacing(-1) 245e41f4b71Sopenharmony_ci .fontSize(12) 246e41f4b71Sopenharmony_ci .border({ width: 1 }) 247e41f4b71Sopenharmony_ci .padding(10) 248e41f4b71Sopenharmony_ci .width('100%') 249e41f4b71Sopenharmony_ci .margin(5) 250e41f4b71Sopenharmony_ci ``` 251e41f4b71Sopenharmony_ci 252e41f4b71Sopenharmony_ci  253e41f4b71Sopenharmony_ci 254e41f4b71Sopenharmony_ci- Use the **minFontSize** and **maxFontSize** attributes to set the minimum and maximum font size, respectively. For the settings to take effect, these attributes must be used together with **maxLines** or layout constraint settings. 255e41f4b71Sopenharmony_ci 256e41f4b71Sopenharmony_ci ```ts 257e41f4b71Sopenharmony_ci Text('My maximum font size is 30, minimum font size is 5, width is 250, and maximum number of lines is 1') 258e41f4b71Sopenharmony_ci .width(250) 259e41f4b71Sopenharmony_ci .maxLines(1) 260e41f4b71Sopenharmony_ci .maxFontSize(30) 261e41f4b71Sopenharmony_ci .minFontSize(5) 262e41f4b71Sopenharmony_ci .border({ width: 1 }) 263e41f4b71Sopenharmony_ci .padding(10) 264e41f4b71Sopenharmony_ci .margin(5) 265e41f4b71Sopenharmony_ci Text('My maximum font size is 30, minimum font size is 5, width is 250, and maximum number of lines is 2') 266e41f4b71Sopenharmony_ci .width(250) 267e41f4b71Sopenharmony_ci .maxLines(2) 268e41f4b71Sopenharmony_ci .maxFontSize(30) 269e41f4b71Sopenharmony_ci .minFontSize(5) 270e41f4b71Sopenharmony_ci .border({ width: 1 }) 271e41f4b71Sopenharmony_ci .padding(10) 272e41f4b71Sopenharmony_ci .margin(5) 273e41f4b71Sopenharmony_ci Text('My maximum font size is 30, minimum font size is 15, width is 250, and line height is 50') 274e41f4b71Sopenharmony_ci .width(250) 275e41f4b71Sopenharmony_ci .height(50) 276e41f4b71Sopenharmony_ci .maxFontSize(30) 277e41f4b71Sopenharmony_ci .minFontSize(15) 278e41f4b71Sopenharmony_ci .border({ width: 1 }) 279e41f4b71Sopenharmony_ci .padding(10) 280e41f4b71Sopenharmony_ci .margin(5) 281e41f4b71Sopenharmony_ci Text('My maximum font size is 30, minimum font size is 15, width is 250, and line height is 100') 282e41f4b71Sopenharmony_ci .width(250) 283e41f4b71Sopenharmony_ci .height(100) 284e41f4b71Sopenharmony_ci .maxFontSize(30) 285e41f4b71Sopenharmony_ci .minFontSize(15) 286e41f4b71Sopenharmony_ci .border({ width: 1 }) 287e41f4b71Sopenharmony_ci .padding(10) 288e41f4b71Sopenharmony_ci .margin(5) 289e41f4b71Sopenharmony_ci ``` 290e41f4b71Sopenharmony_ci 291e41f4b71Sopenharmony_ci  292e41f4b71Sopenharmony_ci 293e41f4b71Sopenharmony_ci- Use the **textCase** attribute to set the text case. 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci ```ts 296e41f4b71Sopenharmony_ci Text('This is the text content with textCase set to Normal.') 297e41f4b71Sopenharmony_ci .textCase(TextCase.Normal) 298e41f4b71Sopenharmony_ci .padding(10) 299e41f4b71Sopenharmony_ci .border({ width: 1 }) 300e41f4b71Sopenharmony_ci .padding(10) 301e41f4b71Sopenharmony_ci .margin(5) 302e41f4b71Sopenharmony_ci 303e41f4b71Sopenharmony_ci // The text is displayed in lowercase. 304e41f4b71Sopenharmony_ci Text('This is the text content with textCase set to LowerCase.') 305e41f4b71Sopenharmony_ci .textCase(TextCase.LowerCase) 306e41f4b71Sopenharmony_ci .border({ width: 1 }) 307e41f4b71Sopenharmony_ci .padding(10) 308e41f4b71Sopenharmony_ci .margin(5) 309e41f4b71Sopenharmony_ci 310e41f4b71Sopenharmony_ci // The text is displayed in uppercase. 311e41f4b71Sopenharmony_ci Text('This is the text content with textCase set to UpperCase.') 312e41f4b71Sopenharmony_ci .textCase(TextCase.UpperCase) 313e41f4b71Sopenharmony_ci .border({ width: 1 }) 314e41f4b71Sopenharmony_ci .padding(10) 315e41f4b71Sopenharmony_ci .margin(5) 316e41f4b71Sopenharmony_ci ``` 317e41f4b71Sopenharmony_ci 318e41f4b71Sopenharmony_ci  319e41f4b71Sopenharmony_ci 320e41f4b71Sopenharmony_ci- Use the **copyOption** attribute to set whether copy and paste is allowed. 321e41f4b71Sopenharmony_ci 322e41f4b71Sopenharmony_ci ```ts 323e41f4b71Sopenharmony_ci Text("This text is copyable") 324e41f4b71Sopenharmony_ci .fontSize(30) 325e41f4b71Sopenharmony_ci .copyOption(CopyOptions.InApp) 326e41f4b71Sopenharmony_ci ``` 327e41f4b71Sopenharmony_ci 328e41f4b71Sopenharmony_ci  329e41f4b71Sopenharmony_ci 330e41f4b71Sopenharmony_ci 331e41f4b71Sopenharmony_ci## Adding Events 332e41f4b71Sopenharmony_ci 333e41f4b71Sopenharmony_ciThe **\<Text>** component supports the [universal events](../reference/arkui-ts/ts-universal-events-click.md). It can be bound to the **onClick**, **onTouch**, or other events to respond to user operations. 334e41f4b71Sopenharmony_ci 335e41f4b71Sopenharmony_ci 336e41f4b71Sopenharmony_ci```ts 337e41f4b71Sopenharmony_ciText ('Click Me') 338e41f4b71Sopenharmony_ci .onClick(()=>{ 339e41f4b71Sopenharmony_ci console.info('I am the response to the click event'); 340e41f4b71Sopenharmony_ci }) 341e41f4b71Sopenharmony_ci``` 342e41f4b71Sopenharmony_ci 343e41f4b71Sopenharmony_ci 344e41f4b71Sopenharmony_ci## Example Scenario 345e41f4b71Sopenharmony_ci 346e41f4b71Sopenharmony_ci 347e41f4b71Sopenharmony_ci```ts 348e41f4b71Sopenharmony_ci// xxx.ets 349e41f4b71Sopenharmony_ci@Entry 350e41f4b71Sopenharmony_ci@Component 351e41f4b71Sopenharmony_cistruct TextExample { 352e41f4b71Sopenharmony_ci build() { 353e41f4b71Sopenharmony_ci Column() { 354e41f4b71Sopenharmony_ci Row() { 355e41f4b71Sopenharmony_ci Text("1").fontSize(14).fontColor(Color.Red).margin({ left: 10, right: 10 }) 356e41f4b71Sopenharmony_ci Text("I am entry 1") 357e41f4b71Sopenharmony_ci .fontSize(12) 358e41f4b71Sopenharmony_ci .fontColor(Color.Blue) 359e41f4b71Sopenharmony_ci .maxLines(1) 360e41f4b71Sopenharmony_ci .textOverflow({ overflow: TextOverflow.Ellipsis }) 361e41f4b71Sopenharmony_ci .fontWeight(300) 362e41f4b71Sopenharmony_ci Text ("Top Hit") 363e41f4b71Sopenharmony_ci .margin({ left: 6 }) 364e41f4b71Sopenharmony_ci .textAlign(TextAlign.Center) 365e41f4b71Sopenharmony_ci .fontSize(10) 366e41f4b71Sopenharmony_ci .fontColor(Color.White) 367e41f4b71Sopenharmony_ci .fontWeight(600) 368e41f4b71Sopenharmony_ci .backgroundColor(0x770100) 369e41f4b71Sopenharmony_ci .borderRadius(5) 370e41f4b71Sopenharmony_ci .width(15) 371e41f4b71Sopenharmony_ci .height(14) 372e41f4b71Sopenharmony_ci }.width('100%').margin(5) 373e41f4b71Sopenharmony_ci 374e41f4b71Sopenharmony_ci Row() { 375e41f4b71Sopenharmony_ci Text("2").fontSize(14).fontColor(Color.Red).margin({ left: 10, right: 10 }) 376e41f4b71Sopenharmony_ci Text("I am entry 2") 377e41f4b71Sopenharmony_ci .fontSize(12) 378e41f4b71Sopenharmony_ci .fontColor(Color.Blue) 379e41f4b71Sopenharmony_ci .fontWeight(300) 380e41f4b71Sopenharmony_ci .constraintSize({ maxWidth: 200 }) 381e41f4b71Sopenharmony_ci .maxLines(1) 382e41f4b71Sopenharmony_ci .textOverflow({ overflow: TextOverflow.Ellipsis }) 383e41f4b71Sopenharmony_ci Text ("Hot") 384e41f4b71Sopenharmony_ci .margin({ left: 6 }) 385e41f4b71Sopenharmony_ci .textAlign(TextAlign.Center) 386e41f4b71Sopenharmony_ci .fontSize(10) 387e41f4b71Sopenharmony_ci .fontColor(Color.White) 388e41f4b71Sopenharmony_ci .fontWeight(600) 389e41f4b71Sopenharmony_ci .backgroundColor(0xCC5500) 390e41f4b71Sopenharmony_ci .borderRadius(5) 391e41f4b71Sopenharmony_ci .width(15) 392e41f4b71Sopenharmony_ci .height(14) 393e41f4b71Sopenharmony_ci }.width('100%').margin(5) 394e41f4b71Sopenharmony_ci 395e41f4b71Sopenharmony_ci Row() { 396e41f4b71Sopenharmony_ci Text("3").fontSize(14).fontColor(Color.Orange).margin({ left: 10, right: 10 }) 397e41f4b71Sopenharmony_ci Text("I am entry 3") 398e41f4b71Sopenharmony_ci .fontSize(12) 399e41f4b71Sopenharmony_ci .fontColor(Color.Blue) 400e41f4b71Sopenharmony_ci .fontWeight(300) 401e41f4b71Sopenharmony_ci .maxLines(1) 402e41f4b71Sopenharmony_ci .constraintSize({ maxWidth: 200 }) 403e41f4b71Sopenharmony_ci .textOverflow({ overflow: TextOverflow.Ellipsis }) 404e41f4b71Sopenharmony_ci Text ("Hot") 405e41f4b71Sopenharmony_ci .margin({ left: 6 }) 406e41f4b71Sopenharmony_ci .textAlign(TextAlign.Center) 407e41f4b71Sopenharmony_ci .fontSize(10) 408e41f4b71Sopenharmony_ci .fontColor(Color.White) 409e41f4b71Sopenharmony_ci .fontWeight(600) 410e41f4b71Sopenharmony_ci .backgroundColor(0xCC5500) 411e41f4b71Sopenharmony_ci .borderRadius(5) 412e41f4b71Sopenharmony_ci .width(15) 413e41f4b71Sopenharmony_ci .height(14) 414e41f4b71Sopenharmony_ci }.width('100%').margin(5) 415e41f4b71Sopenharmony_ci 416e41f4b71Sopenharmony_ci Row() { 417e41f4b71Sopenharmony_ci Text("4").fontSize(14).fontColor(Color.Grey).margin({ left: 10, right: 10 }) 418e41f4b71Sopenharmony_ci Text("I am entry 4") 419e41f4b71Sopenharmony_ci .fontSize(12) 420e41f4b71Sopenharmony_ci .fontColor(Color.Blue) 421e41f4b71Sopenharmony_ci .fontWeight(300) 422e41f4b71Sopenharmony_ci .constraintSize({ maxWidth: 200 }) 423e41f4b71Sopenharmony_ci .maxLines(1) 424e41f4b71Sopenharmony_ci .textOverflow({ overflow: TextOverflow.Ellipsis }) 425e41f4b71Sopenharmony_ci }.width('100%').margin(5) 426e41f4b71Sopenharmony_ci }.width('100%') 427e41f4b71Sopenharmony_ci } 428e41f4b71Sopenharmony_ci} 429e41f4b71Sopenharmony_ci 430e41f4b71Sopenharmony_ci``` 431e41f4b71Sopenharmony_ci 432e41f4b71Sopenharmony_ci 433