1e41f4b71Sopenharmony_ci# button 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci 4e41f4b71Sopenharmony_ciThe **\<button>** component includes capsule, circle, and text buttons. 5e41f4b71Sopenharmony_ci 6e41f4b71Sopenharmony_ci> **NOTE** 7e41f4b71Sopenharmony_ci> 8e41f4b71Sopenharmony_ci> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci## Child Components 11e41f4b71Sopenharmony_ci 12e41f4b71Sopenharmony_ciNot supported 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci## Attributes 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ciIn addition to the [universal attributes](js-service-widget-common-attributes.md), the following attributes are supported. 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci| Name| Type| Default Value| Mandatory| Description| 20e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- | 21e41f4b71Sopenharmony_ci| type | string | capsule | No| Type of the **Enter** key on the soft keyboard. The value cannot be dynamically updated. If this attribute is not set, a capsule-like button is displayed. Unlike the capsule button, the capsule-like button allows its corners to be configured using **border-radius**. Available button types are as follows:<br>- **capsule**: capsule button with fillets, background color, and text.<br>- **circle**: circle button that can accommodate icons.<br>- **text**: text button, which displays only text.| 22e41f4b71Sopenharmony_ci| value | string | - | No| Text value of the button. This attribute is unavailable for circle buttons.| 23e41f4b71Sopenharmony_ci| icon | string | - | No| Path of the button icon. The supported icon formats are JPG, PNG, and SVG.| 24e41f4b71Sopenharmony_ci| placement | string | end | No| Position of the button icon in text. This attribute is valid only when **type** is not set. Available values are as follows:<br>- **start**: The button icon is at the beginning of the text.<br>- **end**: The button icon is at the end of the text.<br>- **top**: The button icon is at the top of the text.<br>- **bottom**: The button icon is at the bottom of the text.| 25e41f4b71Sopenharmony_ci| waiting | boolean | false | No| Whether the button is in waiting state. The value **true** means that the button is in waiting state, and a loading animation is displayed on the left of the text.| 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_ci## Events 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ciThe [universal events](js-service-widget-common-events.md) are supported. 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci## Styles 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ciIn addition to the [universal styles](js-service-widget-common-styles.md), the following styles are supported. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci| Name| Type| Default Value| Mandatory| Description| 38e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- | 39e41f4b71Sopenharmony_ci| text-color | <color> | - | No| Text color of the button.| 40e41f4b71Sopenharmony_ci| font-size | <length> | - | No| Font size of the button.| 41e41f4b71Sopenharmony_ci| font-style | string | normal | No| Font style of the button.| 42e41f4b71Sopenharmony_ci| font-weight | number \| string | normal | No| Font weight of a button. For details, see the **font-weight** style of the **[\<text>](js-service-widget-basic-text.md#styles)** component.| 43e41f4b71Sopenharmony_ci| font-family | <string> | sans-serif | No| Font family, in which fonts are separated by commas (,). Each font is set using a font name or font family name. The first font in the family or the specified [custom font](js-service-widget-common-customizing-font.md) is used for the text.| 44e41f4b71Sopenharmony_ci| icon-width | <length> | - | No| Width of the internal icon of a circle button. By default, the icon takes up the entire width of the button.<br>This style must be set when the icon uses an SVG image.| 45e41f4b71Sopenharmony_ci| icon-height | <length> | - | No| Height of the internal icon of a circle button. By default, the icon takes up the entire height of the button.<br>This style must be set when the icon uses an SVG image.| 46e41f4b71Sopenharmony_ci| radius | <length> | - | No| Radius of a circle button or fillet radius of a capsule button. For a circle button, this style takes precedence over **width** and **height** in the universal styles.| 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci> **NOTE** 49e41f4b71Sopenharmony_ci> - For capsule buttons, border-related styles are not supported. 50e41f4b71Sopenharmony_ci> 51e41f4b71Sopenharmony_ci> - For circle buttons, text-related styles are not supported. 52e41f4b71Sopenharmony_ci> 53e41f4b71Sopenharmony_ci> - For text buttons, the text size is automatically adaptive, and **radius**, **width**, and **height** cannot be set. The **background-color** style is not supported when the background is completely transparent. 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci## Example 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci```html 60e41f4b71Sopenharmony_ci<!-- xxx.hml --> 61e41f4b71Sopenharmony_ci<div class="div-button"> 62e41f4b71Sopenharmony_ci <button class="button" type="capsule" value="Capsule button"></button> 63e41f4b71Sopenharmony_ci <button class="button circle" type="circle" icon="common/ic_add_default.png"></button> 64e41f4b71Sopenharmony_ci <button class="button text" type="text">Text button</button> 65e41f4b71Sopenharmony_ci</div> 66e41f4b71Sopenharmony_ci``` 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ci```css 70e41f4b71Sopenharmony_ci/* xxx.css */ 71e41f4b71Sopenharmony_ci.div-button { 72e41f4b71Sopenharmony_ci flex-direction: column; 73e41f4b71Sopenharmony_ci align-items: center; 74e41f4b71Sopenharmony_ci} 75e41f4b71Sopenharmony_ci.button { 76e41f4b71Sopenharmony_ci margin-top: 15px; 77e41f4b71Sopenharmony_ci} 78e41f4b71Sopenharmony_ci.circle { 79e41f4b71Sopenharmony_ci background-color: #007dff; 80e41f4b71Sopenharmony_ci radius: 72px; 81e41f4b71Sopenharmony_ci icon-width: 72px; 82e41f4b71Sopenharmony_ci icon-height: 72px; 83e41f4b71Sopenharmony_ci} 84e41f4b71Sopenharmony_ci.text { 85e41f4b71Sopenharmony_ci text-color: red; 86e41f4b71Sopenharmony_ci font-size: 40px; 87e41f4b71Sopenharmony_ci font-weight: 900; 88e41f4b71Sopenharmony_ci font-family: sans-serif; 89e41f4b71Sopenharmony_ci font-style: normal; 90e41f4b71Sopenharmony_ci} 91e41f4b71Sopenharmony_ci``` 92e41f4b71Sopenharmony_ci**4 x 4 widget** 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci 95