SliderCard 滚动条卡片

代码演示

Studio 风格

import { ClassicSliderCard, ClassicLargeSliderCard } from 'tuya-panel-classic-kit';
<ClassicSliderCard
style={{ marginTop: 20 }}
title="Slider Card"
icon={TuyaRNSvgs.power}
value={value}
unit="%"
handValueChange={setValue}
canTouchTrack
/>
<ClassicLargeSliderCard
icon={TuyaRNSvgs.power}
showIconBg
iconBgColor={{
deg: 90,
stops: {
'0%': 'red',
'100%': 'yellow',
},
}}
style={{ marginTop: 20 }}
title="Thick sliders"
unit="%"
value={value}
handSlidingComplete={setValue}
disabled
/>

北欧风

import { NordicLargeSliderCard } from 'tuya-panel-nordic-kit';
<NordicLargeSliderCard
title="The wind speed"
icon={TuyaRNSvgs.power}
maximumValue={enumValue.length - 1}
minimumValue={0}
value={0}
renderValue={value => enumValue[value]}
/>;

亚克力风格

import { AcrylicSliderCard } from 'tuya-panel-acrylic-kit';
<AcrylicSliderCard
iconSize={20}
title="Function"
icon={IMAGE}
bothSideIcons={[
{ icon: IMAGE, isImage: true },
{ icon: IMAGE, isImage: true },
]}
bothSideIconIsImage
iconIsImage
value={value1}
bottomPromptTexts={['Low', 'Max']}
handValueChange={setValue1}
/>
<AcrylicSliderCard
style={{ marginTop: 20 }}
iconSize={20}
iconIsImage
title="Function"
icon={IMAGE}
bothSideIcons={[{ icon: TuyaRNSvgs.power }, { icon: TuyaRNSvgs.power }]}
value={value1}
bottomPromptTexts={['min', 'max']}
handSlidingComplete={setValue1}
/>
<AcrylicSliderCard
style={{ marginTop: 20 }}
iconSize={20}
title="Function"
icon={TuyaRNSvgs.power}
maximumValue={enumValue.length - 1}
minimumValue={0}
value={0}
bottomPromptTexts={['min', 'max']}
renderValue={value => enumValue[value]}
/>

API

ClassicSliderCard

属性名描述类型默认值
sliderPropsSlider props 文档:https://panel-docs.tuyacn.com/docs/data-entry/sliderSliderProps--
style外层容器样式StyleProp--
titleStyle标题容器样式StyleProp--
titleTextStyle标题字体样式StyleProp--
contentStyle内容容器样式StyleProp--
thumbStyleSlider滑块样式StyleProp--
themeSliderProps.theme 文档:https://panel-docs.tuyacn.com/docs/data-entry/sliderRecord--
backgroundColor组件背景颜色string--
radius组件背景圆角number--
maximumValue最大值number100
minimumValue最小值number0
trackStyle滑动槽样式StyleProp--
value滑动条的值number--
unit参数的单位string--
stepValue滑动条步长number1
hasControl滑动条是否为受控的booleanfalse
canTouchTrack触摸轨道是否可以更改值booleanfalse
disabled是否禁用boolean--
handValueChange值改变回调(value: number) => void--
handSlidingComplete值改变完成回调(value: number) => void--
type滑块的类型,parcel:包裹类型"parcel" | "normal"normal
renderMinimumTrack定制渲染小于当前值的轨道() => ReactElement>--
renderTitle自定义渲染标题(value: number) => ReactElement>--
padding外层容器的padding [上,右,下,左]number[]--
title标题string--
showTitle是否显示标题booleantrue
titleFontColor标题字体颜色string--
titleFontSize标题字体大小number--
titleFontWeight标题字重"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
valueFontColor参数字体颜色string--
valueFontSize参数字体大小number--
valueFontWeight参数字重"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
sliderBgColor滑动条背景色string--
sliderGrooveBgColor滑动槽背景色string--
sliderThumbColor滑块颜色string--
sliderThumbSize滑块大小number--
sliderThumbRadius滑块圆角number--
bottomPromptTexts底部左右提示文字[string, string]--
bottomPromptTextFontSize底部提示文字字体大小number--
bottomPromptTextFontColor底部提示文字字体颜色string--
bottomPromptTextFontWeight底部提示文字字重"normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"--
bothSideIcons滑动条两侧的图标[IconItem, IconItem]--
bothSideIconSize滑动条两侧图标的尺寸number--
bothSideIconColor滑动条两侧图标的颜色string--
renderValue自定义的值的渲染(value: number) => ReactNode--
iconIsImage卡片图标是否为图片booleanfalse
icon图标 svg pathstring--
iconSize图标尺寸numbercx(24)
iconBgSize组件背景尺寸numbercx(50)
showIconBg是否显示图标背景booleantrue
iconColor图标颜色string#fff
iconBgColor图标背景颜色 只能设置 rgb、rgba 或者 hexBackgroundType#158CFB
iconBgRadius图标背景圆角numbercx(50)
tuya07:31