1e41f4b71Sopenharmony_ci# advanced.Counter
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciA counter is a component used to accurately adjust values.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci>  **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci>  This component is supported since API version 11. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Modules to Import
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci```
12e41f4b71Sopenharmony_ciimport { CounterType, CounterComponent, CounterOptions, DateData } from '@kit.ArkUI';
13e41f4b71Sopenharmony_ci```
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci##  Child Components
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ciNot supported
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci## CounterComponent
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ciCounterComponent({ options: CounterOptions })
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ciDefines a counter.
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci**Decorator**: @Component
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ci**Parameters**
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci| Name   | Type                             | Mandatory| Decorator| Description                   |
34e41f4b71Sopenharmony_ci| ------- | --------------------------------- | ---- | ---------- | ----------------------- |
35e41f4b71Sopenharmony_ci| options | [CounterOptions](#counteroptions) | Yes  | @Prop      | Parameters of the counter.|
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci## CounterOptions
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ciDefines the type and style parameters of the counter.
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_ci| Name       | Type      | Mandatory       | Description                           |
46e41f4b71Sopenharmony_ci| ----------- | ---------- | ------| --------------------------------- |
47e41f4b71Sopenharmony_ci| type | [CounterType](#countertype) | Yes  | Type of the current counter.|
48e41f4b71Sopenharmony_ci| direction<sup>12+</sup> | [Direction](ts-appendix-enums.md#direction) | No| Layout direction.<br>Default value: **Direction.Auto**|
49e41f4b71Sopenharmony_ci| numberOptions | [NumberStyleOptions](#numberstyleoptions) | No   | Parameters of the number style counter.|
50e41f4b71Sopenharmony_ci| inlineOptions | [InlineStyleOptions](#inlinestyleoptions) | No| Parameters of the inline number style counter.|
51e41f4b71Sopenharmony_ci| dateOptions | [DateStyleOptions](#datestyleoptions) | No| Parameters of the inline date style counter.|
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ciA counter type must go with parameters of the matching counter style. Below is a mapping between the counter types and counter styles.
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci| Counter Type            | Counter Style       |
56e41f4b71Sopenharmony_ci| ----------------------- | ------------------ |
57e41f4b71Sopenharmony_ci| CounterType.LIST        | NumberStyleOptions |
58e41f4b71Sopenharmony_ci| CounterType.COMPACT     | NumberStyleOptions |
59e41f4b71Sopenharmony_ci| CounterType.INLINE      | InlineStyleOptions |
60e41f4b71Sopenharmony_ci| CounterType.INLINE_DATE | DateStyleOptions   |
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci## CounterType
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ciEnumerates the counter types.
65e41f4b71Sopenharmony_ci
66e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci| Name       | Description                       |
71e41f4b71Sopenharmony_ci| ----------- | --------------------------- |
72e41f4b71Sopenharmony_ci| LIST        | List counter.            |
73e41f4b71Sopenharmony_ci| COMPACT     | Compact counter.            |
74e41f4b71Sopenharmony_ci| INLINE      | Inline number counter.|
75e41f4b71Sopenharmony_ci| INLINE_DATE | Inline date counter.      |
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_ci## CommonOptions
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ciDefines common attributes and events of counters.
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci| Name           | Type                     | Mandatory| Default Value| Description                                                        |
87e41f4b71Sopenharmony_ci| --------------- | ------------------------- | ---- | ------ | ------------------------------------------------------------ |
88e41f4b71Sopenharmony_ci| focusable       | boolean                   | No  | true   | Whether the counter is focusable.<br>**NOTE**<br>This attribute takes effect for the number style counter.|
89e41f4b71Sopenharmony_ci| step            | number                    | No  | 1      | Step of the counter.<br>Value range: an integer greater than or equal to 1.         |
90e41f4b71Sopenharmony_ci| onHoverIncrease | (isHover: boolean) =>void | No  | -      | Callback invoked when the mouse pointer is moved over or away from the Increase button of the counter.<br>**isHover**: whether the mouse pointer hovers over the component. The value **true** means that the mouse pointer enters the component, and the value **false** means that the mouse pointer leaves the component.|
91e41f4b71Sopenharmony_ci| onHoverDecrease | (isHover: boolean) =>void | No  | -      | Callback invoked when the mouse pointer is moved over or away from the Decrease button of the counter.<br>**isHover**: whether the mouse pointer hovers over the component. The value **true** means that the mouse pointer enters the component, and the value **false** means that the mouse pointer leaves the component.|
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci##  InlineStyleOptions
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ciDefines the attributes and events of the inline number style counter.
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ciInherits from [CommonOptions](#commonoptions).
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci| Name     | Type                  | Mandatory| Default Value| Description                                                  |
104e41f4b71Sopenharmony_ci| --------- | ---------------------- | ---- | ------ | ------------------------------------------------------ |
105e41f4b71Sopenharmony_ci| value     | number                 | No  | 0      | Initial value of the counter.                                 |
106e41f4b71Sopenharmony_ci| min       | number                 | No  | 0      | Minimum value of the counter.                                 |
107e41f4b71Sopenharmony_ci| max       | number                 | No  | 999    | Maximum value of the counter.                                 |
108e41f4b71Sopenharmony_ci| textWidth | number                 | No  | 0      | Text width of the counter.                                  |
109e41f4b71Sopenharmony_ci| onChange  | (value: number) =>void | No  | -      | Callback invoked when the value changes. The current value is returned.<br>**value**: current value.|
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ci## NumberStyleOptions
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ciDefines the attributes and events of the number style counter.
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ciInherits from [InlineStyleOptions](#inlinestyleoptions).
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
120e41f4b71Sopenharmony_ci
121e41f4b71Sopenharmony_ci| Name           | Type                                                        | Mandatory| Default Value| Description                                         |
122e41f4b71Sopenharmony_ci| --------------- | ------------------------------------------------------------ | ---- | ------ | --------------------------------------------- |
123e41f4b71Sopenharmony_ci| label           | [ResourceStr](ts-types.md#resourcestr) | No  | -      | Label of the counter.                      |
124e41f4b71Sopenharmony_ci| onFocusIncrease | () =>void                                                    | No  | -      | Callback invoked when the Increase button of the counter gains focus.|
125e41f4b71Sopenharmony_ci| onFocusDecrease | () =>void                                                    | No  | -      | Callback invoked when the Decrease button of the counter gains focus.|
126e41f4b71Sopenharmony_ci| onBlurIncrease  | () =>void                                                    | No  | -      | Callback invoked when the Increase button of the counter loses focus.|
127e41f4b71Sopenharmony_ci| onBlurDecrease  | () =>void                                                    | No  | -      | Callback invoked when the Decrease button of the counter loses focus.|
128e41f4b71Sopenharmony_ci
129e41f4b71Sopenharmony_ci## DateStyleOptions
130e41f4b71Sopenharmony_ci
131e41f4b71Sopenharmony_ciDefines the attributes and events of the inline date style counter.
132e41f4b71Sopenharmony_ci
133e41f4b71Sopenharmony_ciInherits from [CommonOptions](#commonoptions).
134e41f4b71Sopenharmony_ci
135e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
136e41f4b71Sopenharmony_ci
137e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
138e41f4b71Sopenharmony_ci
139e41f4b71Sopenharmony_ci| Name        | Type                               | Mandatory| Default Value| Description                                                     |
140e41f4b71Sopenharmony_ci| ------------ | ----------------------------------- | ---- | ------ | --------------------------------------------------------- |
141e41f4b71Sopenharmony_ci| year         | number                              | No  | 1      | Initial year of the counter.                                 |
142e41f4b71Sopenharmony_ci| month        | number                              | No  | 1      | Initial month of the counter.                                 |
143e41f4b71Sopenharmony_ci| day          | number                              | No  | 1      | Initial day of the counter.                                   |
144e41f4b71Sopenharmony_ci| onDateChange | (date: [DateData](#datedata))=>void | No  | -      | Callback invoked when the date changes. The current date is returned.<br>**date**: current date.|
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ci## DateData
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ciDefines common date attributes and methods.
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_ci| Name      | Type  | Description                        |
155e41f4b71Sopenharmony_ci| ---------- | ------ | ---------------------------- |
156e41f4b71Sopenharmony_ci| year       | number | Initial year of the counter.    |
157e41f4b71Sopenharmony_ci| month      | number | Initial month of the counter.    |
158e41f4b71Sopenharmony_ci| day        | number | Initial day of the counter.      |
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci### constructor
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ciconstructor(year: number, month: number, day: number)
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ciA constructor used to create a **DateData** object.
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci| Name| Type| Description|
171e41f4b71Sopenharmony_ci| ---------- | ------ | ---------------------------- |
172e41f4b71Sopenharmony_ci| year       | number | Initial year of the counter.    |
173e41f4b71Sopenharmony_ci| month      | number | Initial month of the counter.    |
174e41f4b71Sopenharmony_ci| day        | number | Initial day of the counter.      |
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_ci### toString
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_citoString(): string
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ciCurrent date.
181e41f4b71Sopenharmony_ci
182e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
185e41f4b71Sopenharmony_ci
186e41f4b71Sopenharmony_ci**Return value**
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci| Type| Description|
189e41f4b71Sopenharmony_ci| -------- | -------- |
190e41f4b71Sopenharmony_ci| string | Current date.|
191e41f4b71Sopenharmony_ci
192e41f4b71Sopenharmony_ci## Example  
193e41f4b71Sopenharmony_ci
194e41f4b71Sopenharmony_ci### Example 1
195e41f4b71Sopenharmony_ci
196e41f4b71Sopenharmony_ci```ts
197e41f4b71Sopenharmony_ciimport { CounterType, CounterComponent } from '@kit.ArkUI';
198e41f4b71Sopenharmony_ci
199e41f4b71Sopenharmony_ci@Entry
200e41f4b71Sopenharmony_ci@Component
201e41f4b71Sopenharmony_cistruct ListCounterExample {
202e41f4b71Sopenharmony_ci  build() {
203e41f4b71Sopenharmony_ci    Column() {
204e41f4b71Sopenharmony_ci      // List counter
205e41f4b71Sopenharmony_ci      CounterComponent({
206e41f4b71Sopenharmony_ci        options: {
207e41f4b71Sopenharmony_ci          type: CounterType.LIST,
208e41f4b71Sopenharmony_ci          numberOptions: {
209e41f4b71Sopenharmony_ci            label: "Price",
210e41f4b71Sopenharmony_ci            min: 0,
211e41f4b71Sopenharmony_ci            value: 5,
212e41f4b71Sopenharmony_ci            max: 10
213e41f4b71Sopenharmony_ci          }
214e41f4b71Sopenharmony_ci        }
215e41f4b71Sopenharmony_ci      })
216e41f4b71Sopenharmony_ci    }
217e41f4b71Sopenharmony_ci  }
218e41f4b71Sopenharmony_ci}
219e41f4b71Sopenharmony_ci```
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_ci![listcounter](figures/listcounter.gif)
222e41f4b71Sopenharmony_ci### Example 2
223e41f4b71Sopenharmony_ci```ts
224e41f4b71Sopenharmony_ciimport { CounterType, CounterComponent } from '@kit.ArkUI';
225e41f4b71Sopenharmony_ci
226e41f4b71Sopenharmony_ci@Entry
227e41f4b71Sopenharmony_ci@Component
228e41f4b71Sopenharmony_cistruct CompactCounterExample {
229e41f4b71Sopenharmony_ci  build() {
230e41f4b71Sopenharmony_ci    Column() {
231e41f4b71Sopenharmony_ci      // Compact counter
232e41f4b71Sopenharmony_ci      CounterComponent({
233e41f4b71Sopenharmony_ci        options: {
234e41f4b71Sopenharmony_ci          type: CounterType.COMPACT,
235e41f4b71Sopenharmony_ci          numberOptions: {
236e41f4b71Sopenharmony_ci            label: "Quantity",
237e41f4b71Sopenharmony_ci            value: 10,
238e41f4b71Sopenharmony_ci            min: 0,
239e41f4b71Sopenharmony_ci            max: 100,
240e41f4b71Sopenharmony_ci            step: 10
241e41f4b71Sopenharmony_ci          }
242e41f4b71Sopenharmony_ci        }
243e41f4b71Sopenharmony_ci      })
244e41f4b71Sopenharmony_ci    }
245e41f4b71Sopenharmony_ci  }
246e41f4b71Sopenharmony_ci}
247e41f4b71Sopenharmony_ci```
248e41f4b71Sopenharmony_ci![compactcounter](figures/compactcounter.gif)
249e41f4b71Sopenharmony_ci### Example 3
250e41f4b71Sopenharmony_ci```ts
251e41f4b71Sopenharmony_ciimport { CounterType, CounterComponent } from '@kit.ArkUI';
252e41f4b71Sopenharmony_ci
253e41f4b71Sopenharmony_ci@Entry
254e41f4b71Sopenharmony_ci@Component
255e41f4b71Sopenharmony_cistruct NumberStyleExample {
256e41f4b71Sopenharmony_ci  build() {
257e41f4b71Sopenharmony_ci    Column() {
258e41f4b71Sopenharmony_ci      // Inline number counter
259e41f4b71Sopenharmony_ci      CounterComponent({
260e41f4b71Sopenharmony_ci        options: {
261e41f4b71Sopenharmony_ci          type: CounterType.INLINE,
262e41f4b71Sopenharmony_ci          inlineOptions: {
263e41f4b71Sopenharmony_ci            value: 100,
264e41f4b71Sopenharmony_ci            min: 10,
265e41f4b71Sopenharmony_ci            step: 2,
266e41f4b71Sopenharmony_ci            max: 1000,
267e41f4b71Sopenharmony_ci            textWidth: 100,
268e41f4b71Sopenharmony_ci            onChange: (value: number) => {
269e41f4b71Sopenharmony_ci              console.log("onDateChange Date: " + value.toString());
270e41f4b71Sopenharmony_ci            }
271e41f4b71Sopenharmony_ci          }
272e41f4b71Sopenharmony_ci        }
273e41f4b71Sopenharmony_ci      })
274e41f4b71Sopenharmony_ci    }
275e41f4b71Sopenharmony_ci  }
276e41f4b71Sopenharmony_ci}
277e41f4b71Sopenharmony_ci```
278e41f4b71Sopenharmony_ci![numberstyle](figures/numberstyle.gif)
279e41f4b71Sopenharmony_ci### Example 4
280e41f4b71Sopenharmony_ci```ts
281e41f4b71Sopenharmony_ciimport { CounterType, CounterComponent, DateData } from '@kit.ArkUI';
282e41f4b71Sopenharmony_ci
283e41f4b71Sopenharmony_ci@Entry
284e41f4b71Sopenharmony_ci@Component
285e41f4b71Sopenharmony_cistruct DataStyleExample {
286e41f4b71Sopenharmony_ci  build() {
287e41f4b71Sopenharmony_ci    Column() {
288e41f4b71Sopenharmony_ci      // Inline date counter
289e41f4b71Sopenharmony_ci      CounterComponent({
290e41f4b71Sopenharmony_ci        options: {
291e41f4b71Sopenharmony_ci          type: CounterType.INLINE_DATE,
292e41f4b71Sopenharmony_ci          dateOptions: {
293e41f4b71Sopenharmony_ci            year: 2016,
294e41f4b71Sopenharmony_ci            onDateChange: (date: DateData) => {
295e41f4b71Sopenharmony_ci              console.log("onDateChange Date: " + date.toString());
296e41f4b71Sopenharmony_ci            }
297e41f4b71Sopenharmony_ci          }
298e41f4b71Sopenharmony_ci        }
299e41f4b71Sopenharmony_ci      })
300e41f4b71Sopenharmony_ci    }
301e41f4b71Sopenharmony_ci  }
302e41f4b71Sopenharmony_ci}
303e41f4b71Sopenharmony_ci```
304e41f4b71Sopenharmony_ci![datestyle](figures/datestyle.gif)
305e41f4b71Sopenharmony_ci
306e41f4b71Sopenharmony_ci### Example 5
307e41f4b71Sopenharmony_ciThis example shows a mirrored layout of different types of counters.
308e41f4b71Sopenharmony_ci
309e41f4b71Sopenharmony_ci```ts
310e41f4b71Sopenharmony_ci// xxx.ets
311e41f4b71Sopenharmony_ciimport { CounterType, CounterComponent, DateData } from '@kit.ArkUI';
312e41f4b71Sopenharmony_ci
313e41f4b71Sopenharmony_ci@Entry
314e41f4b71Sopenharmony_ci@Component
315e41f4b71Sopenharmony_cistruct CounterPage {
316e41f4b71Sopenharmony_ci  @State currentDirection: Direction = Direction.Rtl
317e41f4b71Sopenharmony_ci
318e41f4b71Sopenharmony_ci  build() {
319e41f4b71Sopenharmony_ci    Column({}) {
320e41f4b71Sopenharmony_ci
321e41f4b71Sopenharmony_ci      // List counter
322e41f4b71Sopenharmony_ci      CounterComponent({
323e41f4b71Sopenharmony_ci        options: {
324e41f4b71Sopenharmony_ci          direction: this.currentDirection,
325e41f4b71Sopenharmony_ci          type: CounterType.LIST,
326e41f4b71Sopenharmony_ci          numberOptions: {
327e41f4b71Sopenharmony_ci            label: "Price",
328e41f4b71Sopenharmony_ci            min: 0,
329e41f4b71Sopenharmony_ci            value: 5,
330e41f4b71Sopenharmony_ci            max: 10,
331e41f4b71Sopenharmony_ci          }
332e41f4b71Sopenharmony_ci        }
333e41f4b71Sopenharmony_ci      })
334e41f4b71Sopenharmony_ci        .width('80%')
335e41f4b71Sopenharmony_ci
336e41f4b71Sopenharmony_ci      // Compact counter
337e41f4b71Sopenharmony_ci      CounterComponent({
338e41f4b71Sopenharmony_ci        options: {
339e41f4b71Sopenharmony_ci          direction: this.currentDirection,
340e41f4b71Sopenharmony_ci          type: CounterType.COMPACT,
341e41f4b71Sopenharmony_ci          numberOptions: {
342e41f4b71Sopenharmony_ci            label: "Quantity",
343e41f4b71Sopenharmony_ci            value: 10,
344e41f4b71Sopenharmony_ci            min: 0,
345e41f4b71Sopenharmony_ci            max: 100,
346e41f4b71Sopenharmony_ci            step: 10
347e41f4b71Sopenharmony_ci          }
348e41f4b71Sopenharmony_ci        }
349e41f4b71Sopenharmony_ci      }).margin({ top: 20 })
350e41f4b71Sopenharmony_ci
351e41f4b71Sopenharmony_ci      // Inline number counter
352e41f4b71Sopenharmony_ci      CounterComponent({
353e41f4b71Sopenharmony_ci        options: {
354e41f4b71Sopenharmony_ci          type: CounterType.INLINE,
355e41f4b71Sopenharmony_ci          direction: this.currentDirection,
356e41f4b71Sopenharmony_ci          inlineOptions: {
357e41f4b71Sopenharmony_ci            value: 100,
358e41f4b71Sopenharmony_ci            min: 10,
359e41f4b71Sopenharmony_ci            step: 2,
360e41f4b71Sopenharmony_ci            max: 1000,
361e41f4b71Sopenharmony_ci            textWidth: 100,
362e41f4b71Sopenharmony_ci            onChange: (value: number) => {
363e41f4b71Sopenharmony_ci              console.log("onDateChange Date: " + value.toString());
364e41f4b71Sopenharmony_ci            }
365e41f4b71Sopenharmony_ci          }
366e41f4b71Sopenharmony_ci        }
367e41f4b71Sopenharmony_ci      }).margin({ top: 20 })
368e41f4b71Sopenharmony_ci      // Inline date counter
369e41f4b71Sopenharmony_ci      CounterComponent({
370e41f4b71Sopenharmony_ci        options: {
371e41f4b71Sopenharmony_ci          direction: this.currentDirection,
372e41f4b71Sopenharmony_ci          type: CounterType.INLINE_DATE,
373e41f4b71Sopenharmony_ci          dateOptions: {
374e41f4b71Sopenharmony_ci            year: 2024,
375e41f4b71Sopenharmony_ci            onDateChange: (date: DateData) => {
376e41f4b71Sopenharmony_ci              console.log("onDateChange Date: " + date.toString());
377e41f4b71Sopenharmony_ci            }
378e41f4b71Sopenharmony_ci          }
379e41f4b71Sopenharmony_ci        }
380e41f4b71Sopenharmony_ci      }).margin({ top: 20 })
381e41f4b71Sopenharmony_ci    }
382e41f4b71Sopenharmony_ci    .width('100%')
383e41f4b71Sopenharmony_ci    .height('100%')
384e41f4b71Sopenharmony_ci    .justifyContent(FlexAlign.Center)
385e41f4b71Sopenharmony_ci    .alignItems(HorizontalAlign.Center)
386e41f4b71Sopenharmony_ci  }
387e41f4b71Sopenharmony_ci}
388e41f4b71Sopenharmony_ci```
389e41f4b71Sopenharmony_ci![datestyle](figures/counter_direction.png)
390