• 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 * @since 7
19 */
20/**
21 * Provides a button component.
22 * @form
23 * @since 9
24 */
25declare enum ButtonType {
26  /**
27   * Capsule button (rounded corners default to half the height).
28   * @since 7
29   */
30  /**
31   * Capsule button (rounded corners default to half the height).
32   * @form
33   * @since 9
34   */
35  Capsule,
36
37  /**
38   * Round buttons.
39   * @since 7
40   */
41  /**
42   * Round buttons.
43   * @form
44   * @since 9
45   */
46  Circle,
47
48  /**
49   * Common button (no rounded corners by default).
50   * @since 7
51   */
52  /**
53   * Common button (no rounded corners by default).
54   * @form
55   * @since 9
56   */
57  Normal,
58}
59
60/**
61 * Defines the button options.
62 * @since 7
63 */
64/**
65 * Defines the button options.
66 * @form
67 * @since 9
68 */
69declare interface ButtonOptions {
70  /**
71   * Describes the button style.
72   * @since 7
73   */
74  /**
75   * Describes the button style.
76   * @form
77   * @since 9
78   */
79  type?: ButtonType;
80
81  /**
82   * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled.
83   * @since 7
84   */
85  /**
86   * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled.
87   * @form
88   * @since 9
89   */
90  stateEffect?: boolean;
91}
92
93/**
94 * Defines the Button Component.
95 * @since 7
96 */
97/**
98 * Defines the Button Component.
99 * @form
100 * @since 9
101 */
102interface ButtonInterface {
103  /**
104   * Button object
105   * @since 7
106   */
107  /**
108   * Button object
109   * @form
110   * @since 9
111   */
112  (): ButtonAttribute;
113
114  /**
115   * Create Button with Text child.
116   * @since 7
117   */
118  /**
119   * Create Button with Text child.
120   * @form
121   * @since 9
122   */
123  (options: ButtonOptions): ButtonAttribute;
124
125  /**
126   * Create Button with inner text label.
127   * @since 7
128   */
129  /**
130   * Create Button with inner text label.
131   * @form
132   * @since 9
133   */
134  (label: ResourceStr, options?: ButtonOptions): ButtonAttribute;
135}
136
137/**
138 * Defines the button attribute functions.
139 * @since 7
140 */
141/**
142 * Defines the button attribute functions.
143 * @form
144 * @since 9
145 */
146declare class ButtonAttribute extends CommonMethod<ButtonAttribute> {
147  /**
148   * Describes the button style.
149   * @since 7
150   */
151  /**
152   * Describes the button style.
153   * @form
154   * @since 9
155   */
156  type(value: ButtonType): ButtonAttribute;
157
158  /**
159   * Indicates whether to enable the switchover effect when the button is pressed. When the status is set to false, the switchover effect is disabled.
160   * @since 7
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   * @form
165   * @since 9
166   */
167  stateEffect(value: boolean): ButtonAttribute;
168
169  /**
170   * Text color.
171   * @since 7
172   */
173  /**
174   * Text color.
175   * @form
176   * @since 9
177   */
178  fontColor(value: ResourceColor): ButtonAttribute;
179
180  /**
181   * Text size.
182   * @since 7
183   */
184  /**
185   * Text size.
186   * @form
187   * @since 9
188   */
189  fontSize(value: Length): ButtonAttribute;
190
191  /**
192   * Font weight.
193   * @since 7
194   */
195  /**
196   * Font weight.
197   * @form
198   * @since 9
199   */
200  fontWeight(value: number | FontWeight | string): ButtonAttribute;
201
202  /**
203   * Font style.
204   * @since 8
205   */
206  /**
207   * Font style.
208   * @form
209   * @since 9
210   */
211  fontStyle(value: FontStyle): ButtonAttribute;
212
213  /**
214   * Font family.
215   * @since 8
216   */
217  /**
218   * Font family.
219   * @form
220   * @since 9
221   */
222  fontFamily(value: string | Resource): ButtonAttribute;
223}
224
225/**
226 * Defines Button Component.
227 * @since 7
228 */
229/**
230 * Defines Button Component.
231 * @form
232 * @since 9
233 */
234declare const Button: ButtonInterface;
235
236/**
237 * Defines Button Component instance.
238 * @since 7
239 */
240/**
241 * Defines Button Component instance.
242 * @form
243 * @since 9
244 */
245declare const ButtonInstance: ButtonAttribute;
246