EnumCard

Demo

Studio

import { ClassicEnumCard } from 'tuya-panel-classic-kit';
import TuyaRNSvgs from 'tuya-panel-kit/lib/components/iconfont/svg/defaultSvg';
const IMAGE =
'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADMAAAAzCAYAAAA6oTAqAAAAEXRFWHRTb2Z0d2FyZQBwbmdjcnVzaEB1SfMAAABQSURBVGje7dSxCQBACARB+2/ab8BEeQNhFi6WSYzYLYudDQYGBgYGBgYGBgYGBgYGBgZmcvDqYGBgmhivGQYGBgYGBgYGBgYGBgYGBgbmQw+P/eMrC5UTVAAAAABJRU5ErkJggg==';
const list = [
{
label: 'status1',
icon: TuyaRNSvgs.power,
key: '0',
disabled: true,
},
{
label: 'status2',
icon: TuyaRNSvgs.power,
key: '1',
},
{
label: 'status3',
icon: TuyaRNSvgs.power,
key: '2',
},
{
label: 'status4',
icon: TuyaRNSvgs.power,
key: '3',
},
{
label: 'status5',
icon: TuyaRNSvgs.power,
key: '4',
},
{
label: 'status6',
icon: TuyaRNSvgs.power,
key: '5',
},
];
const list1 = list.map(item => {
return {
...item,
isImage: true,
icon: IMAGE,
};
});
<ClassicEnumCard
width={290}
title="Title"
data={list}
// data={[]}
activeKey={activeKey1}
onActiveKeyChange={onActiveKeyChange}
/>
<ClassicEnumCard
padding={[20, 20, 20, 20]}
style={{ marginTop: 20 }}
title="Title"
showTitle={false}
data={list.slice(0, 4)}
defaultActiveKey="1"
showIconBg={false}
activeIconColor="#ff6700"
activeTextColor="#ff6700"
/>
<ClassicEnumCard
pageCount={3}
style={{ marginTop: 20 }}
data={list}
defaultActiveKey="1"
showIconBg={false}
activeIconColor="#ff6700"
activeTextColor="#ff6700"
/>

Nordic

import { NordicEnumCard } from 'tuya-panel-nordic-kit';
<NordicEnumCard disabled title="Title" data={list} activeKey="0" />
<NordicEnumCard
disabled
style={{ marginTop: 20 }}
title="Title"
showTitle={false}
data={list1.slice(0, 4)}
defaultActiveKey="1"
/>

Acrylic

<AcrylicEnumCard title="Title" data={list} activeKey="0" />
<AcrylicEnumCard
style={{ marginTop: 20 }}
title="Title"
showTitle={false}
data={list1.slice(0, 4)}
defaultActiveKey="1"
/>

API

ClassicEnumCard

NameDescriptionTypeDefault
dataDataSourceEnumItem[](required)
pageCountHow much data is on each pagenumber4
onActiveKeyChangechange key callback(key: string) => void--
disabledWhether to disable componentsboolean--
paddingThe outer container paddingnumber[]--
widthComponent widthnumber--
styleOuter container StyleStyleProp--
textStyleButton text styleStyleProp--
titleStyleCard title styleStyleProp--
titleContentStyleCard title container styleStyleProp--
contentStyleContent container styleStyleProp--
dotWrapperStyleThe dot style of the rotation diagramStyleProp--
activeKeycurrent keystring--
defaultActiveKeydefault keystring--
iconBgColorBackground color for each itemBackgroundType--
activeIconColorIcon color of the currently selected iconstring--
activeIconBgColorBackground color of the currently selected iconBackgroundType--
showTextWhether the button text is displayedboolean--
textColorButton font colorstring--
textFontSizeButton font sizenumber--
textFontWeightButton font weight"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
activeTextColorFont color of the current selected itemstring--
titleCard titlestring--
showTitleWhether to display the card titleboolean--
titleFontSizeCard title font sizenumber--
titleColorCard title font colorstring--
titleFontWeightCard title font weight"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
backgroundColorComponent background colorstring--
radiusComponent radiusnumber--
dotSizedot sizenumber--
dotColordot colorstring--
activeDotColoractive dot colorstring--
iconicon svg pathstring--
iconSizeicon sizenumbercx(24)
iconBgSizeicon background sizenumbercx(50)
showIconWhether to display iconbooleantrue
showIconBgWhether to display icon backgroundbooleantrue
iconColoricon colorstring#fff
iconBgRadiusicon background radiusnumbercx(50)
tuya07:31