• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * Provides a button component.
18 *
19 * @enum { number }
20 * @syscap SystemCapability.ArkUI.ArkUI.Full
21 * @since 7
22 */
23/**
24 * Provides a button component.
25 *
26 * @enum { number }
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @since 9
29 * @form
30 */
31/**
32 * Provides a button component.
33 *
34 * @enum { number }
35 * @syscap SystemCapability.ArkUI.ArkUI.Full
36 * @crossplatform
37 * @since 10
38 * @form
39 */
40declare enum ButtonType {
41  /**
42   * Capsule button (rounded corners default to half the height).
43   *
44   * @syscap SystemCapability.ArkUI.ArkUI.Full
45   * @since 7
46   */
47  /**
48   * Capsule button (rounded corners default to half the height).
49   *
50   * @syscap SystemCapability.ArkUI.ArkUI.Full
51   * @since 9
52   * @form
53   */
54  /**
55   * Capsule button (rounded corners default to half the height).
56   *
57   * @syscap SystemCapability.ArkUI.ArkUI.Full
58   * @crossplatform
59   * @since 10
60   * @form
61   */
62  Capsule,
63
64  /**
65   * Round buttons.
66   *
67   * @syscap SystemCapability.ArkUI.ArkUI.Full
68   * @since 7
69   */
70  /**
71   * Round buttons.
72   *
73   * @syscap SystemCapability.ArkUI.ArkUI.Full
74   * @since 9
75   * @form
76   */
77  /**
78   * Round buttons.
79   *
80   * @syscap SystemCapability.ArkUI.ArkUI.Full
81   * @crossplatform
82   * @since 10
83   * @form
84   */
85  Circle,
86
87  /**
88   * Common button (no rounded corners by default).
89   *
90   * @syscap SystemCapability.ArkUI.ArkUI.Full
91   * @since 7
92   */
93  /**
94   * Common button (no rounded corners by default).
95   *
96   * @syscap SystemCapability.ArkUI.ArkUI.Full
97   * @since 9
98   * @form
99   */
100  /**
101   * Common button (no rounded corners by default).
102   *
103   * @syscap SystemCapability.ArkUI.ArkUI.Full
104   * @crossplatform
105   * @since 10
106   * @form
107   */
108  Normal,
109}
110
111/**
112 * Defines the button options.
113 *
114 * @interface ButtonOptions
115 * @syscap SystemCapability.ArkUI.ArkUI.Full
116 * @since 7
117 */
118/**
119 * Defines the button options.
120 *
121 * @interface ButtonOptions
122 * @syscap SystemCapability.ArkUI.ArkUI.Full
123 * @since 9
124 * @form
125 */
126/**
127 * Defines the button options.
128 *
129 * @interface ButtonOptions
130 * @syscap SystemCapability.ArkUI.ArkUI.Full
131 * @crossplatform
132 * @since 10
133 * @form
134 */
135declare interface ButtonOptions {
136  /**
137   * Describes the button style.
138   *
139   * @type { ?ButtonType }
140   * @syscap SystemCapability.ArkUI.ArkUI.Full
141   * @since 7
142   */
143  /**
144   * Describes the button style.
145   *
146   * @type { ?ButtonType }
147   * @syscap SystemCapability.ArkUI.ArkUI.Full
148   * @since 9
149   * @form
150   */
151  /**
152   * Describes the button style.
153   *
154   * @type { ?ButtonType }
155   * @syscap SystemCapability.ArkUI.ArkUI.Full
156   * @crossplatform
157   * @since 10
158   * @form
159   */
160  type?: ButtonType;
161
162  /**
163   * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled.
164   *
165   * @type { ?boolean }
166   * @syscap SystemCapability.ArkUI.ArkUI.Full
167   * @since 7
168   */
169  /**
170   * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled.
171   *
172   * @type { ?boolean }
173   * @syscap SystemCapability.ArkUI.ArkUI.Full
174   * @since 9
175   * @form
176   */
177  /**
178   * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled.
179   *
180   * @type { ?boolean }
181   * @syscap SystemCapability.ArkUI.ArkUI.Full
182   * @crossplatform
183   * @since 10
184   * @form
185   */
186  stateEffect?: boolean;
187}
188
189/**
190 * Defines the Button Component.
191 *
192 * @interface ButtonInterface
193 * @syscap SystemCapability.ArkUI.ArkUI.Full
194 * @since 7
195 */
196/**
197 * Defines the Button Component.
198 *
199 * @interface ButtonInterface
200 * @syscap SystemCapability.ArkUI.ArkUI.Full
201 * @since 9
202 * @form
203 */
204/**
205 * Defines the Button Component.
206 *
207 * @interface ButtonInterface
208 * @syscap SystemCapability.ArkUI.ArkUI.Full
209 * @crossplatform
210 * @since 10
211 * @form
212 */
213interface ButtonInterface {
214  /**
215   * Button object
216   *
217   * @returns { ButtonAttribute }
218   * @syscap SystemCapability.ArkUI.ArkUI.Full
219   * @since 7
220   */
221  /**
222   * Button object
223   *
224   * @returns { ButtonAttribute }
225   * @syscap SystemCapability.ArkUI.ArkUI.Full
226   * @since 9
227   * @form
228   */
229  /**
230   * Button object
231   *
232   * @returns { ButtonAttribute }
233   * @syscap SystemCapability.ArkUI.ArkUI.Full
234   * @crossplatform
235   * @since 10
236   * @form
237   */
238  (): ButtonAttribute;
239
240  /**
241   * Create Button with Text child.
242   *
243   * @param { ButtonOptions } options
244   * @returns { ButtonAttribute }
245   * @syscap SystemCapability.ArkUI.ArkUI.Full
246   * @since 7
247   */
248  /**
249   * Create Button with Text child.
250   *
251   * @param { ButtonOptions } options
252   * @returns { ButtonAttribute }
253   * @syscap SystemCapability.ArkUI.ArkUI.Full
254   * @since 9
255   * @form
256   */
257  /**
258   * Create Button with Text child.
259   *
260   * @param { ButtonOptions } options
261   * @returns { ButtonAttribute }
262   * @syscap SystemCapability.ArkUI.ArkUI.Full
263   * @crossplatform
264   * @since 10
265   * @form
266   */
267  (options: ButtonOptions): ButtonAttribute;
268
269  /**
270   * Create Button with inner text label.
271   *
272   * @param { ResourceStr } label
273   * @param { ButtonOptions } options
274   * @returns { ButtonAttribute }
275   * @syscap SystemCapability.ArkUI.ArkUI.Full
276   * @since 7
277   */
278  /**
279   * Create Button with inner text label.
280   *
281   * @param { ResourceStr } label
282   * @param { ButtonOptions } options
283   * @returns { ButtonAttribute }
284   * @syscap SystemCapability.ArkUI.ArkUI.Full
285   * @since 9
286   * @form
287   */
288  /**
289   * Create Button with inner text label.
290   *
291   * @param { ResourceStr } label
292   * @param { ButtonOptions } options
293   * @returns { ButtonAttribute }
294   * @syscap SystemCapability.ArkUI.ArkUI.Full
295   * @crossplatform
296   * @since 10
297   * @form
298   */
299  (label: ResourceStr, options?: ButtonOptions): ButtonAttribute;
300}
301
302/**
303 * LabelStyle object.
304 *
305 * @interface LabelStyle
306 * @syscap SystemCapability.ArkUI.ArkUI.Full
307 * @crossplatform
308 * @since 10
309 */
310declare interface LabelStyle {
311  /**
312   * overflow mode.
313   *
314   * @type { ?TextOverflow }
315   * @syscap SystemCapability.ArkUI.ArkUI.Full
316   * @crossplatform
317   * @since 10
318   */
319  overflow?: TextOverflow;
320
321  /**
322   * Label max lines.
323   *
324   * @type { ?number }
325   * @syscap SystemCapability.ArkUI.ArkUI.Full
326   * @crossplatform
327   * @since 10
328   */
329  maxLines?: number;
330
331  /**
332   * Min font size for adapted height.
333   *
334   * @type { ?(number | ResourceStr) }
335   * @syscap SystemCapability.ArkUI.ArkUI.Full
336   * @crossplatform
337   * @since 10
338   */
339  minFontSize?: number | ResourceStr;
340
341  /**
342   * Max font size for adapted height.
343   *
344   * @type { ?(number | ResourceStr) }
345   * @syscap SystemCapability.ArkUI.ArkUI.Full
346   * @crossplatform
347   * @since 10
348   */
349  maxFontSize?: number | ResourceStr;
350
351  /**
352   * Adapt text height option.
353   *
354   * @type { ?TextHeightAdaptivePolicy }
355   * @syscap SystemCapability.ArkUI.ArkUI.Full
356   * @crossplatform
357   * @since 10
358   */
359  heightAdaptivePolicy?: TextHeightAdaptivePolicy;
360
361  /**
362   * Font style.
363   *
364   * @type { ?Font }
365   * @syscap SystemCapability.ArkUI.ArkUI.Full
366   * @crossplatform
367   * @since 10
368   */
369  font?: Font;
370}
371
372/**
373 * Defines the button attribute functions.
374 *
375 * @extends CommonMethod
376 * @syscap SystemCapability.ArkUI.ArkUI.Full
377 * @since 7
378 */
379/**
380 * Defines the button attribute functions.
381 *
382 * @extends CommonMethod
383 * @syscap SystemCapability.ArkUI.ArkUI.Full
384 * @since 9
385 * @form
386 */
387/**
388 * Defines the button attribute functions.
389 *
390 * @extends CommonMethod
391 * @syscap SystemCapability.ArkUI.ArkUI.Full
392 * @crossplatform
393 * @since 10
394 * @form
395 */
396declare class ButtonAttribute extends CommonMethod<ButtonAttribute> {
397  /**
398   * Describes the button style.
399   *
400   * @param { ButtonType } value
401   * @returns { ButtonAttribute }
402   * @syscap SystemCapability.ArkUI.ArkUI.Full
403   * @since 7
404   */
405  /**
406   * Describes the button style.
407   *
408   * @param { ButtonType } value
409   * @returns { ButtonAttribute }
410   * @syscap SystemCapability.ArkUI.ArkUI.Full
411   * @since 9
412   * @form
413   */
414  /**
415   * Describes the button style.
416   *
417   * @param { ButtonType } value
418   * @returns { ButtonAttribute }
419   * @syscap SystemCapability.ArkUI.ArkUI.Full
420   * @crossplatform
421   * @since 10
422   * @form
423   */
424  type(value: ButtonType): ButtonAttribute;
425
426  /**
427   * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled.
428   *
429   * @param { boolean } value
430   * @returns { ButtonAttribute }
431   * @syscap SystemCapability.ArkUI.ArkUI.Full
432   * @since 7
433   */
434  /**
435   * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled.
436   *
437   * @param { boolean } value
438   * @returns { ButtonAttribute }
439   * @syscap SystemCapability.ArkUI.ArkUI.Full
440   * @since 9
441   * @form
442   */
443  /**
444   * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled.
445   *
446   * @param { boolean } value
447   * @returns { ButtonAttribute }
448   * @syscap SystemCapability.ArkUI.ArkUI.Full
449   * @crossplatform
450   * @since 10
451   * @form
452   */
453  stateEffect(value: boolean): ButtonAttribute;
454
455  /**
456   * Text color.
457   *
458   * @param { ResourceColor } value
459   * @returns { ButtonAttribute }
460   * @syscap SystemCapability.ArkUI.ArkUI.Full
461   * @since 7
462   */
463  /**
464   * Text color.
465   *
466   * @param { ResourceColor } value
467   * @returns { ButtonAttribute }
468   * @syscap SystemCapability.ArkUI.ArkUI.Full
469   * @since 9
470   * @form
471   */
472  /**
473   * Text color.
474   *
475   * @param { ResourceColor } value
476   * @returns { ButtonAttribute }
477   * @syscap SystemCapability.ArkUI.ArkUI.Full
478   * @crossplatform
479   * @since 10
480   * @form
481   */
482  fontColor(value: ResourceColor): ButtonAttribute;
483
484  /**
485   * Text size.
486   *
487   * @param { Length } value
488   * @returns { ButtonAttribute }
489   * @syscap SystemCapability.ArkUI.ArkUI.Full
490   * @since 7
491   */
492  /**
493   * Text size.
494   *
495   * @param { Length } value
496   * @returns { ButtonAttribute }
497   * @syscap SystemCapability.ArkUI.ArkUI.Full
498   * @since 9
499   * @form
500   */
501  /**
502   * Text size.
503   *
504   * @param { Length } value
505   * @returns { ButtonAttribute }
506   * @syscap SystemCapability.ArkUI.ArkUI.Full
507   * @crossplatform
508   * @since 10
509   * @form
510   */
511  fontSize(value: Length): ButtonAttribute;
512
513  /**
514   * Font weight.
515   *
516   * @param { number | FontWeight | string } value
517   * @returns { ButtonAttribute }
518   * @syscap SystemCapability.ArkUI.ArkUI.Full
519   * @since 7
520   */
521  /**
522   * Font weight.
523   *
524   * @param { number | FontWeight | string } value
525   * @returns { ButtonAttribute }
526   * @syscap SystemCapability.ArkUI.ArkUI.Full
527   * @since 9
528   * @form
529   */
530  /**
531   * Font weight.
532   *
533   * @param { number | FontWeight | string } value
534   * @returns { ButtonAttribute }
535   * @syscap SystemCapability.ArkUI.ArkUI.Full
536   * @crossplatform
537   * @since 10
538   * @form
539   */
540  fontWeight(value: number | FontWeight | string): ButtonAttribute;
541
542  /**
543   * Font style.
544   *
545   * @param { FontStyle } value
546   * @returns { ButtonAttribute }
547   * @syscap SystemCapability.ArkUI.ArkUI.Full
548   * @since 8
549   */
550  /**
551   * Font style.
552   *
553   * @param { FontStyle } value
554   * @returns { ButtonAttribute }
555   * @syscap SystemCapability.ArkUI.ArkUI.Full
556   * @since 9
557   * @form
558   */
559  /**
560   * Font style.
561   *
562   * @param { FontStyle } value
563   * @returns { ButtonAttribute }
564   * @syscap SystemCapability.ArkUI.ArkUI.Full
565   * @crossplatform
566   * @since 10
567   * @form
568   */
569  fontStyle(value: FontStyle): ButtonAttribute;
570
571  /**
572   * Font family.
573   *
574   * @param { string | Resource } value
575   * @returns { ButtonAttribute }
576   * @syscap SystemCapability.ArkUI.ArkUI.Full
577   * @since 8
578   */
579  /**
580   * Font family.
581   *
582   * @param { string | Resource } value
583   * @returns { ButtonAttribute }
584   * @syscap SystemCapability.ArkUI.ArkUI.Full
585   * @since 9
586   * @form
587   */
588  /**
589   * Font family.
590   *
591   * @param { string | Resource } value
592   * @returns { ButtonAttribute }
593   * @syscap SystemCapability.ArkUI.ArkUI.Full
594   * @crossplatform
595   * @since 10
596   * @form
597   */
598  fontFamily(value: string | Resource): ButtonAttribute;
599
600  /**
601   * Set button label style.
602   *
603   * @param { LabelStyle } value - The label style configuration on button.
604   * @returns { ButtonAttribute }
605   * @syscap SystemCapability.ArkUI.ArkUI.Full
606   * @crossplatform
607   * @since 10
608   */
609  labelStyle(value: LabelStyle): ButtonAttribute;
610}
611
612/**
613 * Defines Button Component.
614 *
615 * @syscap SystemCapability.ArkUI.ArkUI.Full
616 * @since 7
617 */
618/**
619 * Defines Button Component.
620 *
621 * @syscap SystemCapability.ArkUI.ArkUI.Full
622 * @since 9
623 * @form
624 */
625/**
626 * Defines Button Component.
627 *
628 * @syscap SystemCapability.ArkUI.ArkUI.Full
629 * @crossplatform
630 * @since 10
631 * @form
632 */
633declare const Button: ButtonInterface;
634
635/**
636 * Defines Button Component instance.
637 *
638 * @syscap SystemCapability.ArkUI.ArkUI.Full
639 * @since 7
640 */
641/**
642 * Defines Button Component instance.
643 *
644 * @syscap SystemCapability.ArkUI.ArkUI.Full
645 * @since 9
646 * @form
647 */
648/**
649 * Defines Button Component instance.
650 *
651 * @syscap SystemCapability.ArkUI.ArkUI.Full
652 * @crossplatform
653 * @since 10
654 * @form
655 */
656declare const ButtonInstance: ButtonAttribute;
657