Icon
内容组件

内容与媒体 / 图标

Icon

直接渲染 macOS 原生 SF Symbols 矢量图标,支持任意 Retina 缩放与单色、层级、调色板及多色渲染模式,无需打包任何 SVG 文件。

签名#

签名
<Icon
  name="sun.max.fill"
  size={28}
  weight="semibold"
  color="theme.warning"
  renderingMode="multicolor"
/>
SF Symbol · 多色渲染
sun.max.fill

属性#

继承 StyleProps:

namestring必填
Apple SF Symbols 图标名(如 "flame.fill"、"drop.fill"、"bolt.fill"、"calendar"、"wifi")。
sizenumber默认 16
图标字号尺寸(pt)。
weightstring可选
线条粗细(如 "regular"、"medium"、"semibold"、"bold")。
colorstring默认 "theme.ink"
图标着色(语义色令牌或十六进制色值)。
renderingModestring默认 "monochrome"
SF Symbols 渲染模式:"monochrome"(单色)、"hierarchical"(层级)、"palette"(调色板)或 "multicolor"(多色,天气图标推荐)。

示例:三种渲染模式对比#

TSX
<HStack spacing={16} alignment="center">
  <Icon name="wifi" size={20}
    color="theme.success"
    renderingMode="monochrome" />
  <Icon name="bell.badge.fill" size={20}
    color="theme.accent"
    renderingMode="hierarchical" />
  <Icon name="cloud.sun.fill" size={24}
    renderingMode="multicolor" />
</HStack>
三种渲染模式对比
monochrome
hierarchical
multicolor