RingGauge
开箱即用的高精度环形仪表盘,内置多色渐变进度弧、居中大字号主数值、副标题与 SF Symbol 图标插槽,一行代码即可搭出专注番茄钟或每日目标主视觉。
签名#
签名
<RingGauge
value={78}
total={100}
size={108}
lineWidth={10}
gradientColors={["#0EA5E9", "#6366F1"]}
centerText="78%"
subText="Weekly"
/>
渐变仪表盘 · 直径 108pt
78%
Weekly
属性#
继承 StyleProps:
valuenumber必填- 当前数值。
totalnumber默认 100- 目标总量。
sizenumber默认 96- 仪表盘外径(pt)。
lineWidthnumber默认 9- 进度弧线宽度(pt)。
colorstring默认 "theme.accent"- 单色进度弧颜色(若设置了
gradientColors则以渐变优先)。 gradientColorsstring[]可选- 多色渐变色标数组(如
["#0EA5E9", "#6366F1"])。 trackColorstring默认 "theme.track"- 未完成底环颜色。
centerTextstring可选- 居中主数值文案(如
"78%"、"18:24"、"6")。 centerFontSizenumber可选- 居中主文案字号(pt)。
subTextstring可选- 主数值下方的辅助标签(如
"/ 8"、"Weekly")。 subFontSizenumber可选- 辅助标签字号(pt)。
iconstring可选- 可选居中或顶部 SF Symbol 图标名。
iconSizenumber可选- 图标尺寸(pt)。
textColorstring默认 "theme.ink"- 居中文字与图标颜色。
示例:图标插槽与渐变仪表盘#
TSX
<HStack spacing={16}>
<RingGauge value={72} size={84}
lineWidth={8} color="theme.warning"
icon="flame.fill" centerText="720" />
<RingGauge value={92} size={84}
lineWidth={8}
gradientColors={["#30D158", "#0EA5E9"]}
centerText="18:24" subText="Focus" />
</HStack>
图标插槽 vs 双色渐变
720
18:24
Focus
真实桌面效果#
