1e41f4b71Sopenharmony_ci# piece 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci> **NOTE** 4e41f4b71Sopenharmony_ci> 5e41f4b71Sopenharmony_ci> This component is supported since API version 5. Updates will be marked with a superscript to indicate their earliest API version. 6e41f4b71Sopenharmony_ci 7e41f4b71Sopenharmony_ciThe **\<piece>** component provides an entrance piece that can contain images and text. It is usually used to display receivers, for example, email recipients or message recipients. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## Child Components 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ciNot supported 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci 14e41f4b71Sopenharmony_ci## Attributes 15e41f4b71Sopenharmony_ci 16e41f4b71Sopenharmony_ciIn addition to the [universal attributes](js-components-common-attributes.md), the following attributes are supported. 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 19e41f4b71Sopenharmony_ci| -------- | ------- | ---- | ------------------------------------------------------------ | 20e41f4b71Sopenharmony_ci| content | string | Yes | Text content of the operational piece. | 21e41f4b71Sopenharmony_ci| closable | boolean | No | Whether to display the delete icon for the operational piece. When users click the delete icon, it triggers the close event.<br>Default value: **false**| 22e41f4b71Sopenharmony_ci| icon | string | No | URL of the delete icon for the operational piece. The value can be a local path. | 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci## Styles 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ciThe [universal styles](js-components-common-styles.md) are supported. 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci> **NOTE** 30e41f4b71Sopenharmony_ci> 31e41f4b71Sopenharmony_ci> By default, text and images are placed in the middle of the **\<piece>** component. 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci## Events 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ciIn addition to the [universal events](js-components-common-events.md), the following events are supported. 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci| Name | Parameter | Description | 39e41f4b71Sopenharmony_ci| ----- | ---- | ----------------------------------- | 40e41f4b71Sopenharmony_ci| close | - | Triggered when users click the delete icon of the operational piece. You can delete this component by using the **if** directive.| 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci## Methods 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ciThe [universal methods](js-components-common-methods.md) are supported. 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci## Example 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci```html 50e41f4b71Sopenharmony_ci<!-- xxx.hml--> 51e41f4b71Sopenharmony_ci<div class="container" > 52e41f4b71Sopenharmony_ci <piece if="{{first}}" content="example"></piece> 53e41f4b71Sopenharmony_ci <piece if="{{second}}" content="example" closable="true" onclose="closeSecond"></piece> 54e41f4b71Sopenharmony_ci</div> 55e41f4b71Sopenharmony_ci``` 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci```css 58e41f4b71Sopenharmony_ci/* xxx.css */ 59e41f4b71Sopenharmony_ci.container { 60e41f4b71Sopenharmony_ci width: 100%; 61e41f4b71Sopenharmony_ci height: 100%; 62e41f4b71Sopenharmony_ci align-items: center; 63e41f4b71Sopenharmony_ci justify-content: center; 64e41f4b71Sopenharmony_ci} 65e41f4b71Sopenharmony_ci``` 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ci```js 68e41f4b71Sopenharmony_ci// xxx.js 69e41f4b71Sopenharmony_ciexport default { 70e41f4b71Sopenharmony_ci data: { 71e41f4b71Sopenharmony_ci first: true, 72e41f4b71Sopenharmony_ci second: true 73e41f4b71Sopenharmony_ci }, 74e41f4b71Sopenharmony_ci closeSecond(e) { 75e41f4b71Sopenharmony_ci this.second = false; 76e41f4b71Sopenharmony_ci } 77e41f4b71Sopenharmony_ci} 78e41f4b71Sopenharmony_ci``` 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ci 81