1e41f4b71Sopenharmony_ci# Panel
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **Panel** component is a slidable panel that presents lightweight content with flexible sizes.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>  **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci>  This component is deprecated since API version 12. You are advised to use the universal attribute [bindSheet](ts-universal-attributes-sheet-transition.md) instead.
8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci>  This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci## Child Components
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ciSupported
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci>  **NOTE**
17e41f4b71Sopenharmony_ci>
18e41f4b71Sopenharmony_ci>  Built-in components and custom components are allowed, with support for ([if/else](../../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../../quick-start/arkts-rendering-control-lazyforeach.md)) rendering control.
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci## APIs
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ciPanel(show: boolean)
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci**Parameters**
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
32e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- |
33e41f4b71Sopenharmony_ci| show | boolean | Yes| Whether the panel is shown.<br>**NOTE**<br>The panel is hidden and does not take up space in the layout if this parameter is set to **false** or [Visible.None](ts-universal-attributes-visibility.md) is set.|
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci## Attributes
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ciIn addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported.
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci### type
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_citype(value: PanelType)
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ciSets the type of the panel.
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci**Parameters**
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
52e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
53e41f4b71Sopenharmony_ci| value   | [PanelType](#paneltype)| Yes  | Type of the panel.<br>Default value: **PanelType.Foldable**|
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci### mode
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_cimode(value: PanelMode)
58e41f4b71Sopenharmony_ci
59e41f4b71Sopenharmony_ciSets the initial mode of the panel.
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ci**Parameters**
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
68e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
69e41f4b71Sopenharmony_ci| value   | [PanelMode](#panelmode) | Yes  | Initial mode of the panel.<br>Default value for the Minibar type: PanelMode.Mini; default value for other types: PanelMode.Half<br>Since API version 10, this attribute supports two-way binding through [$$](../../../quick-start/arkts-two-way-sync.md).|
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci### dragBar
72e41f4b71Sopenharmony_ci
73e41f4b71Sopenharmony_cidragBar(value: boolean)
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ciSets whether to enable a drag bar.
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci**Parameters**
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
84e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
85e41f4b71Sopenharmony_ci| value   | boolean | Yes  | Whether to enable a drag bar. The value **true** means that the drag bar will be displayed, and **false** means the opposite.<br>Default value: **true**|
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci### customHeight<sup>10+</sup>
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_cicustomHeight(value: Dimension | PanelHeight)
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_ciSets the height of the panel in the **PanelType.CUSTOM** type.
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci**Parameters**
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
100e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
101e41f4b71Sopenharmony_ci| value   | [Dimension](ts-types.md#dimension10) \| [PanelHeight](#panelheight10) | Yes  | Height of the panel in the **PanelType.CUSTOM** type.<br>Default value: **0**<br>**NOTE**<br>This attribute cannot be set in percentage.|
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci### fullHeight
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_cifullHeight(value: number | string)
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ciSets the height of the panel in the **PanelMode.Full** type.
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci**Parameters**
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
116e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
117e41f4b71Sopenharmony_ci| value   | string \| number | Yes  | Height of the panel in **PanelMode.Full** mode.<br>Default value: main axis height of the panel minus 8 vp<br>**NOTE**<br>This attribute cannot be set in percentage.|
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci### halfHeight
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_cihalfHeight(value: number | string)
122e41f4b71Sopenharmony_ci
123e41f4b71Sopenharmony_ciSets the height of the panel in **PanelMode.Half** mode.
124e41f4b71Sopenharmony_ci
125e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
126e41f4b71Sopenharmony_ci
127e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci**Parameters**
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
132e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
133e41f4b71Sopenharmony_ci| value   | string \| number | Yes  | Height of the panel in **PanelMode.Half** mode.<br>Default value: half of the main axis height of the panel<br>**NOTE**<br>This attribute cannot be set in percentage.|
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci### miniHeight
136e41f4b71Sopenharmony_ci
137e41f4b71Sopenharmony_ciminiHeight(value: number | string)
138e41f4b71Sopenharmony_ci
139e41f4b71Sopenharmony_ciSets the height of the panel in **PanelMode.Mini** mode.
140e41f4b71Sopenharmony_ci
141e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
142e41f4b71Sopenharmony_ci
143e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
144e41f4b71Sopenharmony_ci
145e41f4b71Sopenharmony_ci**Parameters**
146e41f4b71Sopenharmony_ci
147e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
148e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
149e41f4b71Sopenharmony_ci| value   | string \| number | Yes  | Panel height in the **PanelMode.Mini** mode.<br>Default value: **48**<br>Unit: vp<br>**NOTE**<br>This attribute cannot be set in percentage.|
150e41f4b71Sopenharmony_ci
151e41f4b71Sopenharmony_ci### show
152e41f4b71Sopenharmony_ci
153e41f4b71Sopenharmony_cishow(value: boolean)
154e41f4b71Sopenharmony_ci
155e41f4b71Sopenharmony_ciSets whether the panel is shown.
156e41f4b71Sopenharmony_ci
157e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
158e41f4b71Sopenharmony_ci
159e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
160e41f4b71Sopenharmony_ci
161e41f4b71Sopenharmony_ci**Parameters**
162e41f4b71Sopenharmony_ci
163e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
164e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
165e41f4b71Sopenharmony_ci| value   | boolean | Yes  | Whether the panel is shown. The value **true** means to show the panel, and **false** means the opposite.<br>Default value: **true**<br>**NOTE**<br>The priority of this attribute is higher than that of the **show** parameter.|
166e41f4b71Sopenharmony_ci
167e41f4b71Sopenharmony_ci### backgroundMask<sup>9+</sup>
168e41f4b71Sopenharmony_ci
169e41f4b71Sopenharmony_cibackgroundMask(color: ResourceColor)
170e41f4b71Sopenharmony_ci
171e41f4b71Sopenharmony_ciBackground mask of the panel.
172e41f4b71Sopenharmony_ci
173e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
174e41f4b71Sopenharmony_ci
175e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
176e41f4b71Sopenharmony_ci
177e41f4b71Sopenharmony_ci**Parameters**
178e41f4b71Sopenharmony_ci
179e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
180e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
181e41f4b71Sopenharmony_ci| value   | [ResourceColor](ts-types.md#resourcecolor) | Yes  | Background mask of the panel.<br>Default value: **'#08182431'**|
182e41f4b71Sopenharmony_ci
183e41f4b71Sopenharmony_ci### showCloseIcon<sup>10+</sup>
184e41f4b71Sopenharmony_ci
185e41f4b71Sopenharmony_cishowCloseIcon(value: boolean)
186e41f4b71Sopenharmony_ci
187e41f4b71Sopenharmony_ciSets whether to display the close icon.
188e41f4b71Sopenharmony_ci
189e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
190e41f4b71Sopenharmony_ci
191e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
192e41f4b71Sopenharmony_ci
193e41f4b71Sopenharmony_ci**Parameters**
194e41f4b71Sopenharmony_ci
195e41f4b71Sopenharmony_ci| Name | Type                                                        | Mandatory| Description                                                        |
196e41f4b71Sopenharmony_ci| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
197e41f4b71Sopenharmony_ci| value   | boolean | Yes  | Whether to display the close icon. The value **true** means to display the close icon, and **false** means the opposite.<br>Default value: **false**|
198e41f4b71Sopenharmony_ci
199e41f4b71Sopenharmony_ci## PanelType
200e41f4b71Sopenharmony_ci
201e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
202e41f4b71Sopenharmony_ci
203e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
204e41f4b71Sopenharmony_ci
205e41f4b71Sopenharmony_ci| Name| Description|
206e41f4b71Sopenharmony_ci| -------- | -------- |
207e41f4b71Sopenharmony_ci| Minibar | A minibar panel that displays content in the minibar area or a large (fullscreen-like) area.|
208e41f4b71Sopenharmony_ci| Foldable | A foldable panel that displays permanent content in a large (fullscreen-like), medium-sized (halfscreen-like), or small area.|
209e41f4b71Sopenharmony_ci| Temporary | A temporary panel that displays content in a large (fullscreen-like) or medium-sized (halfscreen-like) area.|
210e41f4b71Sopenharmony_ci| CUSTOM<sup>10+</sup> | A custom panel that automatically adapts its height to the content, but does not support manual resizing.|
211e41f4b71Sopenharmony_ci
212e41f4b71Sopenharmony_ci## PanelMode
213e41f4b71Sopenharmony_ci
214e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
215e41f4b71Sopenharmony_ci
216e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
217e41f4b71Sopenharmony_ci
218e41f4b71Sopenharmony_ci| Name| Value| Description|
219e41f4b71Sopenharmony_ci| -------- | -------- | -------- |
220e41f4b71Sopenharmony_ci| Mini |0| Displays a **minibar** or **foldable** panel in its minimum size. This attribute does not take effect for **temporary** panels.|
221e41f4b71Sopenharmony_ci| Half | 1 | Displays a **foldable** or **temporary** panel in a medium-sized (halfscreen-like) area. This attribute does not take effect for **minibar** panels.|
222e41f4b71Sopenharmony_ci| Full |2  | Displays a panel in a large (fullscreen-like) area.|
223e41f4b71Sopenharmony_ci
224e41f4b71Sopenharmony_ci## PanelHeight<sup>10+</sup>
225e41f4b71Sopenharmony_ci
226e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11.
227e41f4b71Sopenharmony_ci
228e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
229e41f4b71Sopenharmony_ci
230e41f4b71Sopenharmony_ci| Name| Description|
231e41f4b71Sopenharmony_ci| -------- | -------- | 
232e41f4b71Sopenharmony_ci| WRAP_CONTENT | When the type is **CUSTOM**, the panel automatically adapts its height to the content.|
233e41f4b71Sopenharmony_ci## Events
234e41f4b71Sopenharmony_ci
235e41f4b71Sopenharmony_ciIn addition to the [universal events](ts-universal-events-click.md), the following events are supported.
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ci### onChange
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_cionChange(event: (width: number, height: number, mode: PanelMode) =&gt; void)
240e41f4b71Sopenharmony_ci
241e41f4b71Sopenharmony_ciTriggered when the status of the panel changes.
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci**Parameters**
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ci| Name   | Type       | Mandatory| Description                                                                                 |
246e41f4b71Sopenharmony_ci| --------- | ---------  | ---- | ------------------------------------------------------------------------------------ |
247e41f4b71Sopenharmony_ci| width     | number     | Yes  | Width of the content area.                                                                      |
248e41f4b71Sopenharmony_ci| height    | number     | Yes  | Height of the content area.<br>When the value of **dragBar** is **true**, the panel height is the sum of the drag bar height and content area height.|
249e41f4b71Sopenharmony_ci| mode      | PanelMode  | Yes  | Mode of the panel.                                                                          |
250e41f4b71Sopenharmony_ci
251e41f4b71Sopenharmony_ci### onHeightChange<sup>9+</sup>
252e41f4b71Sopenharmony_ci
253e41f4b71Sopenharmony_cionHeightChange(callback: (value: number) => void)
254e41f4b71Sopenharmony_ci
255e41f4b71Sopenharmony_ciTriggered when the height of the panel changes.
256e41f4b71Sopenharmony_ci
257e41f4b71Sopenharmony_ci**Parameters**
258e41f4b71Sopenharmony_ci
259e41f4b71Sopenharmony_ci| Name   | Type                                               | Mandatory| Description      |
260e41f4b71Sopenharmony_ci| --------- | --------------------------------------------------- | ---- | ---------- |
261e41f4b71Sopenharmony_ci| value     | number  | Yes  | Height of the content area. The default unit is px.<br>When the value of **dragBar** is **true**, the panel height is the sum of the drag bar height and content area height.<br>For user experience purposes, the panel can be slid to only this height: **fullHeight** - 8 vp.|
262e41f4b71Sopenharmony_ci
263e41f4b71Sopenharmony_ci## Example
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_ci```ts
266e41f4b71Sopenharmony_ci// xxx.ets
267e41f4b71Sopenharmony_ci@Entry
268e41f4b71Sopenharmony_ci@Component
269e41f4b71Sopenharmony_cistruct PanelExample {
270e41f4b71Sopenharmony_ci  @State show: boolean = false
271e41f4b71Sopenharmony_ci
272e41f4b71Sopenharmony_ci  build() {
273e41f4b71Sopenharmony_ci    Column() {
274e41f4b71Sopenharmony_ci      Text('2021-09-30    Today Calendar: 1.afternoon......Click for details')
275e41f4b71Sopenharmony_ci        .width('90%')
276e41f4b71Sopenharmony_ci        .height(50)
277e41f4b71Sopenharmony_ci        .borderRadius(10)
278e41f4b71Sopenharmony_ci        .backgroundColor(0xFFFFFF)
279e41f4b71Sopenharmony_ci        .padding({ left: 20 })
280e41f4b71Sopenharmony_ci        .onClick(() => {
281e41f4b71Sopenharmony_ci          this.show = !this.show
282e41f4b71Sopenharmony_ci        })
283e41f4b71Sopenharmony_ci      Panel(this.show) { // Display calendar events.
284e41f4b71Sopenharmony_ci        Column() {
285e41f4b71Sopenharmony_ci          Text('Today Calendar')
286e41f4b71Sopenharmony_ci          Divider()
287e41f4b71Sopenharmony_ci          Text('1. afternoon 4:00 The project meeting')
288e41f4b71Sopenharmony_ci        }
289e41f4b71Sopenharmony_ci      }
290e41f4b71Sopenharmony_ci      .type(PanelType.Foldable)
291e41f4b71Sopenharmony_ci      .mode(PanelMode.Half)
292e41f4b71Sopenharmony_ci      .dragBar(true) // The drag bar is enabled by default.
293e41f4b71Sopenharmony_ci      .halfHeight(500) // The panel height is half of the screen height by default.
294e41f4b71Sopenharmony_ci      .showCloseIcon(true) // Display the close icon.
295e41f4b71Sopenharmony_ci      .onChange((width: number, height: number, mode: PanelMode) => {
296e41f4b71Sopenharmony_ci        console.info(`width:${width},height:${height},mode:${mode}`)
297e41f4b71Sopenharmony_ci      })
298e41f4b71Sopenharmony_ci    }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
299e41f4b71Sopenharmony_ci  }
300e41f4b71Sopenharmony_ci}
301e41f4b71Sopenharmony_ci```
302e41f4b71Sopenharmony_ci
303e41f4b71Sopenharmony_ci![en-us_image_0000001174422896](figures/en-us_image_0000001174422896.gif)
304