Last Updated on : 2024-06-05 03:14:34download
tabBar
is used to split the tab
for more fine-grained control. Currently, tabBar
supports two types. The default type is equivalent to tab
.
Note: for more information, see Demo.
import { TabBar } from "tuya-panel-kit";
this.state = {
tab: "2",
};
const tabs = Array.from(Array(10), (v, k) => k + 1).map((v) => {
return { key: `${v}`, title: `Tab${v}` };
});
<TabBar
tabs={tabs}
activeKey={this.state.tab}
onChange={(value) => this.setState({ tab: value })}
underlineStyle={{ width: 20, marginHorizontal: 30 }}
/>;
import { TabBar } from "tuya-panel-kit";
this.state = {
tab: "2",
};
const tabRadios = Array.from(Array(3), (v, k) => k + 1).map((v) => {
return { key: `${v}`, title: `Tab${v}` };
});
<TabBar
type="radio"
tabs={tabRadios}
activeKey={this.state.tab}
onChange={(value) => this.setState({ tab: value })}
style={{ borderColor: "red", margin: 10 }}
/>;
tab
type.
Type | Required | Default value |
---|---|---|
enum: radio, default | No | default |
tab
data.
Type | Required | Default value |
---|---|---|
Array|TabModel |
Yes | None |
The key
of the selected tab
.
Type | Required | Default value |
---|---|---|
string|number |
No | None |
The key
of the tab
that is selected by default.
Type | Required | Default value |
---|---|---|
string|number |
No | 0 |
Callback of tab
switching.
Type | Required | Default value |
---|---|---|
key => {} | No | None |
The style of the inner container of tab
.
Type | Required | Default value |
---|---|---|
ViewPropTyps.style | No | None |
The style of the outer container of tab
.
Type | Required | Default value |
---|---|---|
ViewPropTyps.style | No | None |
Style of the underline.
Type | Required | Default value |
---|---|---|
ViewPropTyps.style | No | None |
The style of each tab
.
Type | Required | Default value |
---|---|---|
ViewPropTyps.style | No | None |
The style of the selected tab
.
Type | Required | Default value |
---|---|---|
ViewPropTyps.style | No | None |
The style of the text in each tab
.
Type | Required | Default value |
---|---|---|
Text.propTypes.style | No | None |
The style of the text in the selected tab
.
Type | Required | Default value |
---|---|---|
Text.propTypes.style | No | None |
tab
title or node name.
Type | Required | Default value |
---|---|---|
string|element |
No | None |
tab
custom style.
Type | Required | Default value |
---|---|---|
ViewPropTyps.style | No | None |
The custom style of the selected tab
.
Note: only the default type supports this property.
Type | Required | Default value |
---|---|---|
ViewPropTyps.style | No | None |
Custom text style of tab
.
Type | Required | Default value |
---|---|---|
Text.propTypes.style | No | None |
The custom style of the text in the selected tab
.
Type | Required | Default value |
---|---|---|
Text.propTypes.style | No | None |
The color of the selected tab
.
Type | Required | Default value |
---|---|---|
string | No | #fff |
The spacing between tab
.
Type | Required | Default value |
---|---|---|
number | No | 2 |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback