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,};});<ClassicEnumCardwidth={290}title="Title"data={list}// data={[]}activeKey={activeKey1}onActiveKeyChange={onActiveKeyChange}/><ClassicEnumCardpadding={[20, 20, 20, 20]}style={{ marginTop: 20 }}title="Title"showTitle={false}data={list.slice(0, 4)}defaultActiveKey="1"showIconBg={false}activeIconColor="#ff6700"activeTextColor="#ff6700"/><ClassicEnumCardpageCount={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" /><NordicEnumCarddisabledstyle={{ marginTop: 20 }}title="Title"showTitle={false}data={list1.slice(0, 4)}defaultActiveKey="1"/>
Acrylic
<AcrylicEnumCard title="Title" data={list} activeKey="0" /><AcrylicEnumCardstyle={{ marginTop: 20 }}title="Title"showTitle={false}data={list1.slice(0, 4)}defaultActiveKey="1"/>
API
ClassicEnumCard
Name | Description | Type | Default |
---|---|---|---|
data | DataSource | EnumItem[] | (required) |
pageCount | How much data is on each page | number | 4 |
onActiveKeyChange | change key callback | (key: string) => void | -- |
disabled | Whether to disable components | boolean | -- |
padding | The outer container padding | number[] | -- |
width | Component width | number | -- |
style | Outer container Style | StyleProp | -- |
textStyle | Button text style | StyleProp | -- |
titleStyle | Card title style | StyleProp | -- |
titleContentStyle | Card title container style | StyleProp | -- |
contentStyle | Content container style | StyleProp | -- |
dotWrapperStyle | The dot style of the rotation diagram | StyleProp | -- |
activeKey | current key | string | -- |
defaultActiveKey | default key | string | -- |
iconBgColor | Background color for each item | BackgroundType | -- |
activeIconColor | Icon color of the currently selected icon | string | -- |
activeIconBgColor | Background color of the currently selected icon | BackgroundType | -- |
showText | Whether the button text is displayed | boolean | -- |
textColor | Button font color | string | -- |
textFontSize | Button font size | number | -- |
textFontWeight | Button font weight | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | -- |
activeTextColor | Font color of the current selected item | string | -- |
title | Card title | string | -- |
showTitle | Whether to display the card title | boolean | -- |
titleFontSize | Card title font size | number | -- |
titleColor | Card title font color | string | -- |
titleFontWeight | Card title font weight | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" | -- |
backgroundColor | Component background color | string | -- |
radius | Component radius | number | -- |
dotSize | dot size | number | -- |
dotColor | dot color | string | -- |
activeDotColor | active dot color | string | -- |
icon | icon svg path | string | -- |
iconSize | icon size | number | cx(24) |
iconBgSize | icon background size | number | cx(50) |
showIcon | Whether to display icon | boolean | true |
showIconBg | Whether to display icon background | boolean | true |
iconColor | icon color | string | #fff |
iconBgRadius | icon background radius | number | cx(50) |