Last Updated on : 2024-06-05 03:14:29download
Button
is one of the most commonly used components, mainly for scenes that need to be clicked, such as plain text, pictures, and buttons.
Code examples of Button
in the specific scenes are as follows.
Note: for more information, see Button Demo.
import { Button } from "tuya-panel-kit";
<Button text="Click me" />;
import { Button } from "tuya-panel-kit";
<Button icon="selected" iconSize={24} text="text" />;
import { Button } from "tuya-panel-kit";
<Button image={require("../../res/2.png")} />;
Inherit the TouchableOpacity
component. For more information, see TouchableOpacity.
Stretch of the button follows the parent container.
Type | Required | Default value |
---|---|---|
boolean |
No | false |
Button size.
Type | Required | Default value |
---|---|---|
enum/number |
No | noSet |
Button type.
global.brand
in the theme.transparent
.Type | Required | Default value |
---|---|---|
enum |
No | normal |
Button text.
Type | Required | Default value |
---|---|---|
string |
No | None |
Button background. It can be a color value or gradient value.
Type | Required | Default value |
---|---|---|
string or object |
No | None |
Whether the text in the button is displayed in only one line, that is, the extra part is displayed with the ellipsis.
Type | Required | Default value |
---|---|---|
boolean |
No | true |
Text arrangement direction in the button. The text is at the bottom of the button by default.
Type | Required | Default value |
---|---|---|
enum |
No | bottom |
The button icon ID. See iconfont-name attribute.
The button icon path. See iconfont-d attribute.
The button icon size. See iconfont-size.
The button icon color. See iconfont-color attribute.
The source picture of the button.
Type | Required | Default value |
---|---|---|
Image.propTypes.source |
No | None |
The tintColor of the button picture.
Type | Required | Default value |
---|---|---|
string |
No | None |
The image style in the button.
Type | Required | Default value |
---|---|---|
ViewPropTypes.style |
No | None |
Transparency when the button is clicked.
Type | Required | Default value |
---|---|---|
number (0 to 1) |
No | 0.5 |
Whether the button is disabled.
Type | Required | Default value |
---|---|---|
boolean |
No | false |
Transparency when the button is disabled.
Type | Required | Default value |
---|---|---|
number (0 to 1) |
No | 0.2 |
Button style.
Type | Required | Default value |
---|---|---|
ViewPropTypes.style |
No | None |
The outermost container style of the button.
Type | Required | Default value |
---|---|---|
ViewPropTypes.style |
No | None |
Button text style.
Type | Required | Default value |
---|---|---|
Text.propTypes.style |
No | None |
Badge style.
Type | Required | Default value |
---|---|---|
ViewPropTypes.style |
No | None |
Badge text style.
Type | Required | Default value |
---|---|---|
Text.propTypes.style |
No | None |
Click callback.
Type | Required | Default value |
---|---|---|
() => {} |
No | None |
Button onLayout callback.
Type | Required | Default value |
---|---|---|
(e) => {} |
No | None |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback