1e41f4b71Sopenharmony_ci# Security Component Universal Attributes 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ciUniversal attributes of security components are basic attributes applicable to all security components. 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ci> **NOTE** 8e41f4b71Sopenharmony_ci> 9e41f4b71Sopenharmony_ci> This component is supported since API version 10. Updates will be marked with a superscript to indicate their earliest API version. 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ci## iconSize 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ciiconSize(value: Dimension): T 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ciSets the icon size of the security component. 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ci**Parameters** 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description | 25e41f4b71Sopenharmony_ci|------------|------|-------|---------| 26e41f4b71Sopenharmony_ci| value | [Dimension](ts-types.md#dimension10) | Yes|Icon size of the security component.<br>Default value: **16vp**| 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci**Return value** 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ci| Type| Description| 31e41f4b71Sopenharmony_ci| -------- | -------- | 32e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci## layoutDirection 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_cilayoutDirection(value: SecurityComponentLayoutDirection): T 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ciSets the direction of the icon and text on the security component. 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci**Parameters** 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description | 47e41f4b71Sopenharmony_ci|------------|------|-------|---------| 48e41f4b71Sopenharmony_ci| value | [SecurityComponentLayoutDirection](#securitycomponentlayoutdirection) |Yes| Direction of the icon and text on the security component.<br>Default value: **SecurityComponentLayoutDirection.HORIZONTAL**| 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ci**Return value** 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_ci| Type| Description| 53e41f4b71Sopenharmony_ci| -------- | -------- | 54e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci## position 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ciposition(value: Position): T 59e41f4b71Sopenharmony_ci 60e41f4b71Sopenharmony_ciSets the absolute position of the security component, that is, the offset of the component's upper left corner relative to its parent container's. 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 63e41f4b71Sopenharmony_ci 64e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ci**Parameters** 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description | 69e41f4b71Sopenharmony_ci|------------|------|-------|---------| 70e41f4b71Sopenharmony_ci| value | [Position](ts-types.md#position) |Yes|Offset of the security component's upper left corner relative to its parent container's.<br>Default value:<br>{<br>x: 0,<br>y: 0<br>}| 71e41f4b71Sopenharmony_ci 72e41f4b71Sopenharmony_ci**Return value** 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ci| Type| Description| 75e41f4b71Sopenharmony_ci| -------- | -------- | 76e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci## markAnchor 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_cimarkAnchor(value: Position): T 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ciSets the anchor of the security component for moving the component with its upper left corner as the reference point. 83e41f4b71Sopenharmony_ci 84e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci**Parameters** 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 91e41f4b71Sopenharmony_ci|------------|------|-------|---------| 92e41f4b71Sopenharmony_ci| value | [Position](ts-types.md#position) |Yes|Anchor of the security component for moving the component with its upper left corner as the reference point. Generally, this attribute is used together with the **position** and **offset** attributes. When used alone, it produces an effect similar to that produced by **offset**.<br>Default value:<br>{<br>x: 0,<br>y: 0<br>}| 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci**Return value** 95e41f4b71Sopenharmony_ci 96e41f4b71Sopenharmony_ci| Type| Description| 97e41f4b71Sopenharmony_ci| -------- | -------- | 98e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 99e41f4b71Sopenharmony_ci 100e41f4b71Sopenharmony_ci## offset 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_cioffset(value: Position | Edges | LocalizedEdges): T 103e41f4b71Sopenharmony_ci 104e41f4b71Sopenharmony_ciSets the coordinate offset of the security control relative to its own layout position. 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 109e41f4b71Sopenharmony_ci 110e41f4b71Sopenharmony_ci**Parameters** 111e41f4b71Sopenharmony_ci 112e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 113e41f4b71Sopenharmony_ci|------------|------|-------|---------| 114e41f4b71Sopenharmony_ci| value | [Position](ts-types.md#position) \| [Edges<sup>12+</sup>](ts-types.md#edges12) \| [LocalizedEdges<sup>12+</sup>](ts-types.md#localizededges12) |Yes|Coordinate offset of the security control relative to its own layout position. This attribute does not affect the layout in the parent container. The offset is used only during drawing.<br>Default value:<br>{<br>x: 0,<br>y: 0<br>}| 115e41f4b71Sopenharmony_ci 116e41f4b71Sopenharmony_ci**Return value** 117e41f4b71Sopenharmony_ci 118e41f4b71Sopenharmony_ci| Type| Description| 119e41f4b71Sopenharmony_ci| -------- | -------- | 120e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 121e41f4b71Sopenharmony_ci 122e41f4b71Sopenharmony_ci## fontSize 123e41f4b71Sopenharmony_ci 124e41f4b71Sopenharmony_cifontSize(value: Dimension): T 125e41f4b71Sopenharmony_ci 126e41f4b71Sopenharmony_ciSets the font size of the text on the security component. 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ci**Parameters** 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 135e41f4b71Sopenharmony_ci|------------|------|-------|---------| 136e41f4b71Sopenharmony_ci| value | [Dimension](ts-types.md#dimension10) |Yes|Font size of the text on the security component.<br>Default value: **16fp**| 137e41f4b71Sopenharmony_ci 138e41f4b71Sopenharmony_ci**Return value** 139e41f4b71Sopenharmony_ci 140e41f4b71Sopenharmony_ci| Type| Description| 141e41f4b71Sopenharmony_ci| -------- | -------- | 142e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 143e41f4b71Sopenharmony_ci 144e41f4b71Sopenharmony_ci## fontStyle 145e41f4b71Sopenharmony_ci 146e41f4b71Sopenharmony_cifontStyle(value: FontStyle): T 147e41f4b71Sopenharmony_ci 148e41f4b71Sopenharmony_ciFont style of the text on the security component. 149e41f4b71Sopenharmony_ci 150e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 151e41f4b71Sopenharmony_ci 152e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 153e41f4b71Sopenharmony_ci 154e41f4b71Sopenharmony_ci**Parameters** 155e41f4b71Sopenharmony_ci 156e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 157e41f4b71Sopenharmony_ci|------------|------|-------|---------| 158e41f4b71Sopenharmony_ci| value | [FontStyle](ts-appendix-enums.md#fontstyle) |Yes|Font style of the text on the security component.<br>Default value: **FontStyle.Normal**| 159e41f4b71Sopenharmony_ci 160e41f4b71Sopenharmony_ci**Return value** 161e41f4b71Sopenharmony_ci 162e41f4b71Sopenharmony_ci| Type| Description| 163e41f4b71Sopenharmony_ci| -------- | -------- | 164e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 165e41f4b71Sopenharmony_ci 166e41f4b71Sopenharmony_ci## fontWeight 167e41f4b71Sopenharmony_ci 168e41f4b71Sopenharmony_cifontWeight(value: number | FontWeight | string): T 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ciSets the font weight of the text on the security component. 171e41f4b71Sopenharmony_ci 172e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 175e41f4b71Sopenharmony_ci 176e41f4b71Sopenharmony_ci**Parameters** 177e41f4b71Sopenharmony_ci 178e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 179e41f4b71Sopenharmony_ci|------------|------|-------|---------| 180e41f4b71Sopenharmony_ci| value | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string |Yes|Font weight of the text on the security component.<br>Default value: **FontWeight.Medium**| 181e41f4b71Sopenharmony_ci 182e41f4b71Sopenharmony_ci**Return value** 183e41f4b71Sopenharmony_ci 184e41f4b71Sopenharmony_ci| Type| Description| 185e41f4b71Sopenharmony_ci| -------- | -------- | 186e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 187e41f4b71Sopenharmony_ci 188e41f4b71Sopenharmony_ci## fontFamily 189e41f4b71Sopenharmony_ci 190e41f4b71Sopenharmony_cifontFamily(value: string | Resource): T 191e41f4b71Sopenharmony_ci 192e41f4b71Sopenharmony_ciSets the font family of the text on the security component. 193e41f4b71Sopenharmony_ci 194e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 195e41f4b71Sopenharmony_ci 196e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 197e41f4b71Sopenharmony_ci 198e41f4b71Sopenharmony_ci**Parameters** 199e41f4b71Sopenharmony_ci 200e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 201e41f4b71Sopenharmony_ci|------------|------|-------|---------| 202e41f4b71Sopenharmony_ci| value | string \| [Resource](ts-types.md#resource) |Yes|Font family of the text on the security component.<br>Default font: **'HarmonyOS Sans'**| 203e41f4b71Sopenharmony_ci 204e41f4b71Sopenharmony_ci**Return value** 205e41f4b71Sopenharmony_ci 206e41f4b71Sopenharmony_ci| Type| Description| 207e41f4b71Sopenharmony_ci| -------- | -------- | 208e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 209e41f4b71Sopenharmony_ci 210e41f4b71Sopenharmony_ci## fontColor 211e41f4b71Sopenharmony_ci 212e41f4b71Sopenharmony_cifontColor(value: ResourceColor): T 213e41f4b71Sopenharmony_ci 214e41f4b71Sopenharmony_ciSets the font color of the text on the security component. 215e41f4b71Sopenharmony_ci 216e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 217e41f4b71Sopenharmony_ci 218e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 219e41f4b71Sopenharmony_ci 220e41f4b71Sopenharmony_ci**Parameters** 221e41f4b71Sopenharmony_ci 222e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 223e41f4b71Sopenharmony_ci|------------|------|-------|---------| 224e41f4b71Sopenharmony_ci| value | [ResourceColor](ts-types.md#resourcecolor) |Yes|Font color of the text on the security component.<br>Default value: **'\#ffffffff'**| 225e41f4b71Sopenharmony_ci 226e41f4b71Sopenharmony_ci**Return value** 227e41f4b71Sopenharmony_ci 228e41f4b71Sopenharmony_ci| Type| Description| 229e41f4b71Sopenharmony_ci| -------- | -------- | 230e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 231e41f4b71Sopenharmony_ci 232e41f4b71Sopenharmony_ci## iconColor 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ciiconColor(value: ResourceColor): T 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ciSets the color of the icon on the security component. 237e41f4b71Sopenharmony_ci 238e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_ci**Parameters** 243e41f4b71Sopenharmony_ci 244e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 245e41f4b71Sopenharmony_ci|------------|------|-------|---------| 246e41f4b71Sopenharmony_ci| value | [ResourceColor](ts-types.md#resourcecolor) |Yes|Color of the icon on the security component.<br>Default value: **'\#ffffffff'**| 247e41f4b71Sopenharmony_ci 248e41f4b71Sopenharmony_ci**Return value** 249e41f4b71Sopenharmony_ci 250e41f4b71Sopenharmony_ci| Type| Description| 251e41f4b71Sopenharmony_ci| -------- | -------- | 252e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 253e41f4b71Sopenharmony_ci 254e41f4b71Sopenharmony_ci## backgroundColor 255e41f4b71Sopenharmony_ci 256e41f4b71Sopenharmony_cibackgroundColor(value: ResourceColor): T 257e41f4b71Sopenharmony_ci 258e41f4b71Sopenharmony_ciSets the background color of the security component. 259e41f4b71Sopenharmony_ci 260e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 261e41f4b71Sopenharmony_ci 262e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 263e41f4b71Sopenharmony_ci 264e41f4b71Sopenharmony_ci**Parameters** 265e41f4b71Sopenharmony_ci 266e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 267e41f4b71Sopenharmony_ci|------------|------|-------|---------| 268e41f4b71Sopenharmony_ci| value | [ResourceColor](ts-types.md#resourcecolor) |Yes|Background color of the security component.<br>Default value: **\#007dff**| 269e41f4b71Sopenharmony_ci 270e41f4b71Sopenharmony_ci**Return value** 271e41f4b71Sopenharmony_ci 272e41f4b71Sopenharmony_ci| Type| Description| 273e41f4b71Sopenharmony_ci| -------- | -------- | 274e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 275e41f4b71Sopenharmony_ci 276e41f4b71Sopenharmony_ci## borderStyle 277e41f4b71Sopenharmony_ci 278e41f4b71Sopenharmony_ciborderStyle(value: BorderStyle): T 279e41f4b71Sopenharmony_ci 280e41f4b71Sopenharmony_ciSets the border style of the security component. 281e41f4b71Sopenharmony_ci 282e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 283e41f4b71Sopenharmony_ci 284e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 285e41f4b71Sopenharmony_ci 286e41f4b71Sopenharmony_ci**Parameters** 287e41f4b71Sopenharmony_ci 288e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 289e41f4b71Sopenharmony_ci|------------|------|-------|---------| 290e41f4b71Sopenharmony_ci| value | [BorderStyle](ts-appendix-enums.md#borderstyle) |Yes|Border style of the security component.<br>By default, the border style is not set.| 291e41f4b71Sopenharmony_ci 292e41f4b71Sopenharmony_ci**Return value** 293e41f4b71Sopenharmony_ci 294e41f4b71Sopenharmony_ci| Type| Description| 295e41f4b71Sopenharmony_ci| -------- | -------- | 296e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 297e41f4b71Sopenharmony_ci 298e41f4b71Sopenharmony_ci## borderWidth 299e41f4b71Sopenharmony_ci 300e41f4b71Sopenharmony_ciborderWidth(value: Dimension): T 301e41f4b71Sopenharmony_ci 302e41f4b71Sopenharmony_ciSets the border width of the security component. 303e41f4b71Sopenharmony_ci 304e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 305e41f4b71Sopenharmony_ci 306e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 307e41f4b71Sopenharmony_ci 308e41f4b71Sopenharmony_ci**Parameters** 309e41f4b71Sopenharmony_ci 310e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 311e41f4b71Sopenharmony_ci|------------|------|-------|---------| 312e41f4b71Sopenharmony_ci| value | [Dimension](ts-types.md#dimension10) |Yes|Border width of the security component.<br>By default, the border width is not set.| 313e41f4b71Sopenharmony_ci 314e41f4b71Sopenharmony_ci**Return value** 315e41f4b71Sopenharmony_ci 316e41f4b71Sopenharmony_ci| Type| Description| 317e41f4b71Sopenharmony_ci| -------- | -------- | 318e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 319e41f4b71Sopenharmony_ci 320e41f4b71Sopenharmony_ci## borderColor 321e41f4b71Sopenharmony_ci 322e41f4b71Sopenharmony_ciborderColor(value: ResourceColor): T 323e41f4b71Sopenharmony_ci 324e41f4b71Sopenharmony_ciSets the border color of the security component. 325e41f4b71Sopenharmony_ci 326e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 327e41f4b71Sopenharmony_ci 328e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 329e41f4b71Sopenharmony_ci 330e41f4b71Sopenharmony_ci**Parameters** 331e41f4b71Sopenharmony_ci 332e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 333e41f4b71Sopenharmony_ci|------------|------|-------|---------| 334e41f4b71Sopenharmony_ci| value | [ResourceColor](ts-types.md#resourcecolor) |Yes|Border color of the security component.<br>By default, the border color is not set.| 335e41f4b71Sopenharmony_ci 336e41f4b71Sopenharmony_ci**Return value** 337e41f4b71Sopenharmony_ci 338e41f4b71Sopenharmony_ci| Type| Description| 339e41f4b71Sopenharmony_ci| -------- | -------- | 340e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 341e41f4b71Sopenharmony_ci 342e41f4b71Sopenharmony_ci## borderRadius 343e41f4b71Sopenharmony_ci 344e41f4b71Sopenharmony_ciborderRadius(value: Dimension): T 345e41f4b71Sopenharmony_ci 346e41f4b71Sopenharmony_ciSets the radius of the rounded border corners of the security component. 347e41f4b71Sopenharmony_ci 348e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 349e41f4b71Sopenharmony_ci 350e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 351e41f4b71Sopenharmony_ci 352e41f4b71Sopenharmony_ci**Parameters** 353e41f4b71Sopenharmony_ci 354e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 355e41f4b71Sopenharmony_ci|------------|------|-------|---------| 356e41f4b71Sopenharmony_ci| value | [Dimension](ts-types.md#dimension10) |Yes|Radius of the rounded border corners of the security component.| 357e41f4b71Sopenharmony_ci 358e41f4b71Sopenharmony_ci**Return value** 359e41f4b71Sopenharmony_ci 360e41f4b71Sopenharmony_ci| Type| Description| 361e41f4b71Sopenharmony_ci| -------- | -------- | 362e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 363e41f4b71Sopenharmony_ci 364e41f4b71Sopenharmony_ci## padding 365e41f4b71Sopenharmony_ci 366e41f4b71Sopenharmony_cipadding(value: Padding | Dimension): T 367e41f4b71Sopenharmony_ci 368e41f4b71Sopenharmony_ciSets the padding of the security component. 369e41f4b71Sopenharmony_ci 370e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 371e41f4b71Sopenharmony_ci 372e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 373e41f4b71Sopenharmony_ci 374e41f4b71Sopenharmony_ci**Parameters** 375e41f4b71Sopenharmony_ci 376e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 377e41f4b71Sopenharmony_ci|------------|------|-------|---------| 378e41f4b71Sopenharmony_ci| value | [Padding](ts-types.md#padding) \| [Dimension](ts-types.md#dimension10) |Yes|Padding of the security component.<br>Default value: 12 vp for the top and bottom paddings and 24 vp for the left and right paddings| 379e41f4b71Sopenharmony_ci 380e41f4b71Sopenharmony_ci**Return value** 381e41f4b71Sopenharmony_ci 382e41f4b71Sopenharmony_ci| Type| Description| 383e41f4b71Sopenharmony_ci| -------- | -------- | 384e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 385e41f4b71Sopenharmony_ci 386e41f4b71Sopenharmony_ci## textIconSpace 387e41f4b71Sopenharmony_ci 388e41f4b71Sopenharmony_citextIconSpace(value: Dimension): T 389e41f4b71Sopenharmony_ci 390e41f4b71Sopenharmony_ciSets the space between the icon and text on the security component. 391e41f4b71Sopenharmony_ci 392e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 393e41f4b71Sopenharmony_ci 394e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 395e41f4b71Sopenharmony_ci 396e41f4b71Sopenharmony_ci**Parameters** 397e41f4b71Sopenharmony_ci 398e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 399e41f4b71Sopenharmony_ci|------------|------|-------|---------| 400e41f4b71Sopenharmony_ci| value | [Dimension](ts-types.md#dimension10) |Yes|Space between the icon and text on the security component.<br>Default value: **4vp**| 401e41f4b71Sopenharmony_ci 402e41f4b71Sopenharmony_ci**Return value** 403e41f4b71Sopenharmony_ci 404e41f4b71Sopenharmony_ci| Type| Description| 405e41f4b71Sopenharmony_ci| -------- | -------- | 406e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 407e41f4b71Sopenharmony_ci 408e41f4b71Sopenharmony_ci## width<sup>11+</sup> 409e41f4b71Sopenharmony_ci 410e41f4b71Sopenharmony_ciwidth(value: Length): T 411e41f4b71Sopenharmony_ci 412e41f4b71Sopenharmony_ciSets the width of the security component. By default, the security component automatically adapts its width to the content. 413e41f4b71Sopenharmony_ci 414e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 415e41f4b71Sopenharmony_ci 416e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 417e41f4b71Sopenharmony_ci 418e41f4b71Sopenharmony_ci**Parameters** 419e41f4b71Sopenharmony_ci 420e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 421e41f4b71Sopenharmony_ci|------------|------|-------|---------| 422e41f4b71Sopenharmony_ci|value | [Length](ts-types.md#length) |Yes|Width of the security component. By default, the security component automatically adapts its width to the content. If the set width is less than the minimum width allowed by the current combination of attributes, the width will be adjusted to the set value, and the button text will automatically wrap to maintain the complete display of the security component.| 423e41f4b71Sopenharmony_ci 424e41f4b71Sopenharmony_ci**Return value** 425e41f4b71Sopenharmony_ci 426e41f4b71Sopenharmony_ci| Type| Description| 427e41f4b71Sopenharmony_ci| -------- | -------- | 428e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 429e41f4b71Sopenharmony_ci 430e41f4b71Sopenharmony_ci## height<sup>11+</sup> 431e41f4b71Sopenharmony_ci 432e41f4b71Sopenharmony_ciheight(value: Length): T 433e41f4b71Sopenharmony_ci 434e41f4b71Sopenharmony_ciSets the height of the security component. By default, the security component automatically adapts its height to the content. 435e41f4b71Sopenharmony_ci 436e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 437e41f4b71Sopenharmony_ci 438e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 439e41f4b71Sopenharmony_ci 440e41f4b71Sopenharmony_ci**Parameters** 441e41f4b71Sopenharmony_ci 442e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 443e41f4b71Sopenharmony_ci|------------|------|-------|---------| 444e41f4b71Sopenharmony_ci| value | [Length](ts-types.md#length) |Yes|Height of the security component. By default, the security component automatically adapts its height to the content. If the value is less than the minimum height allowed by the current attribute combination, the actual height will be greater than the set value to ensure that content of the security component is fully displayed.| 445e41f4b71Sopenharmony_ci 446e41f4b71Sopenharmony_ci**Return value** 447e41f4b71Sopenharmony_ci 448e41f4b71Sopenharmony_ci| Type| Description| 449e41f4b71Sopenharmony_ci| -------- | -------- | 450e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 451e41f4b71Sopenharmony_ci 452e41f4b71Sopenharmony_ci## size<sup>11+</sup> 453e41f4b71Sopenharmony_ci 454e41f4b71Sopenharmony_cisize(value: SizeOptions): T 455e41f4b71Sopenharmony_ci 456e41f4b71Sopenharmony_ciSets the size of the security component. By default, the security component automatically adapts its size to the content. 457e41f4b71Sopenharmony_ci 458e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 459e41f4b71Sopenharmony_ci 460e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 461e41f4b71Sopenharmony_ci 462e41f4b71Sopenharmony_ci**Parameters** 463e41f4b71Sopenharmony_ci 464e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 465e41f4b71Sopenharmony_ci|------------|------|-------|---------| 466e41f4b71Sopenharmony_ci| value | [SizeOptions](ts-types.md#sizeoptions) |Yes|Size of the security component. By default, the security component automatically adapts its size to the content. If the set size is less than the minimum size allowed by the current combination of attributes, the width will be adjusted to the set value while the height will not, and the button text will automatically wrap to ensure the integrity of the display for the security control.| 467e41f4b71Sopenharmony_ci 468e41f4b71Sopenharmony_ci**Return value** 469e41f4b71Sopenharmony_ci 470e41f4b71Sopenharmony_ci| Type| Description| 471e41f4b71Sopenharmony_ci| -------- | -------- | 472e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 473e41f4b71Sopenharmony_ci 474e41f4b71Sopenharmony_ci## constraintSize<sup>11+</sup> 475e41f4b71Sopenharmony_ci 476e41f4b71Sopenharmony_ciconstraintSize(value: ConstraintSizeOptions): T 477e41f4b71Sopenharmony_ci 478e41f4b71Sopenharmony_ciSets the size constraints of the component during component layout. 479e41f4b71Sopenharmony_ci 480e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12. 481e41f4b71Sopenharmony_ci 482e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 483e41f4b71Sopenharmony_ci 484e41f4b71Sopenharmony_ci**Parameters** 485e41f4b71Sopenharmony_ci 486e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 487e41f4b71Sopenharmony_ci|------------|------|-------|---------| 488e41f4b71Sopenharmony_ci| value | [ConstraintSizeOptions](ts-types.md#constraintsizeoptions) |Yes|Size constraints of the component during component layout. **constraintSize** takes precedence over **width** and **height**. Learn [how the value of this attribute affects the width and height](ts-universal-attributes-size.md).<br>As with width and height, if the set size is less than the minimum size allowed by the current combination of attributes, the width will be adjusted to the set value while the height will not, and the button text will automatically wrap to ensure the integrity of the display for the security control.<br>Default value:<br>{<br>minWidth: 0,<br>maxWidth: Infinity,<br>minHeight: 0,<br>maxHeight: Infinity<br>}| 489e41f4b71Sopenharmony_ci 490e41f4b71Sopenharmony_ci**Return value** 491e41f4b71Sopenharmony_ci 492e41f4b71Sopenharmony_ci| Type| Description| 493e41f4b71Sopenharmony_ci| -------- | -------- | 494e41f4b71Sopenharmony_ci| T | Attributes of the security component.| 495e41f4b71Sopenharmony_ci 496e41f4b71Sopenharmony_ci 497e41f4b71Sopenharmony_ci## SecurityComponentLayoutDirection 498e41f4b71Sopenharmony_ci 499e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 500e41f4b71Sopenharmony_ci 501e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 502e41f4b71Sopenharmony_ci 503e41f4b71Sopenharmony_ci| Name| Value| Description| 504e41f4b71Sopenharmony_ci| -------- | -------- | -------- | 505e41f4b71Sopenharmony_ci| HORIZONTAL | 0 | The icon and text on the security component are horizontally arranged.| 506e41f4b71Sopenharmony_ci| VERTICAL | 1 | The icon and text on the security component are vertically arranged.| 507e41f4b71Sopenharmony_ci 508e41f4b71Sopenharmony_ci 509e41f4b71Sopenharmony_ci## Example 510e41f4b71Sopenharmony_ci 511e41f4b71Sopenharmony_ci> **NOTE** 512e41f4b71Sopenharmony_ci> You may want to learn the [restrictions on security component styles](../../../security/AccessToken/security-component-overview.md#constraints) to avoid authorization failures caused by incompliant styles. 513e41f4b71Sopenharmony_ci 514e41f4b71Sopenharmony_ci```ts 515e41f4b71Sopenharmony_ci// xxx.ets 516e41f4b71Sopenharmony_ci@Entry 517e41f4b71Sopenharmony_ci@Component 518e41f4b71Sopenharmony_cistruct Index { 519e41f4b71Sopenharmony_ci build() { 520e41f4b71Sopenharmony_ci Row() { 521e41f4b71Sopenharmony_ci Column({space:5}) { 522e41f4b71Sopenharmony_ci // Generate a save button and set its security component attributes. 523e41f4b71Sopenharmony_ci SaveButton() 524e41f4b71Sopenharmony_ci .fontSize(35) 525e41f4b71Sopenharmony_ci .fontColor(Color.White) 526e41f4b71Sopenharmony_ci .iconSize(30) 527e41f4b71Sopenharmony_ci .layoutDirection(SecurityComponentLayoutDirection.HORIZONTAL) 528e41f4b71Sopenharmony_ci .borderWidth(1) 529e41f4b71Sopenharmony_ci .borderStyle(BorderStyle.Dashed) 530e41f4b71Sopenharmony_ci .borderColor(Color.Blue) 531e41f4b71Sopenharmony_ci .borderRadius(20) 532e41f4b71Sopenharmony_ci .fontWeight(100) 533e41f4b71Sopenharmony_ci .iconColor(Color.White) 534e41f4b71Sopenharmony_ci .padding({left:50, top:50, bottom:50, right:50}) 535e41f4b71Sopenharmony_ci .textIconSpace(20) 536e41f4b71Sopenharmony_ci .backgroundColor(0x3282f6) 537e41f4b71Sopenharmony_ci SaveButton().size({width:200, height:100}) 538e41f4b71Sopenharmony_ci SaveButton().constraintSize({maxWidth:60}) 539e41f4b71Sopenharmony_ci }.width('100%') 540e41f4b71Sopenharmony_ci }.height('100%') 541e41f4b71Sopenharmony_ci } 542e41f4b71Sopenharmony_ci} 543e41f4b71Sopenharmony_ci``` 544e41f4b71Sopenharmony_ci 545e41f4b71Sopenharmony_ci 546