JGuang

导航图标

NavIcon · Astryx

交互预览
npm install @astryxdesign/core@0.7.1 @astryxdesign/theme-neutral@0.7.1 @stylexjs/stylex@0.19.0

导航图标 · NavIcon

导航图标用于导航场景。下面的官方示例展示原生用法与状态,属性名保持上游 API。

安装与前置条件

npm install @astryxdesign/core@0.7.1 @astryxdesign/theme-neutral@0.7.1 @stylexjs/stylex@0.19.0

需要 React 19+,按顺序导入基础 CSS 和主题,并设置 Theme Provider。参见开始使用。

示例与使用方式

  • 导航图标 · 综合展示 1:首先体验这个示例,再查看代码理解组件的组合方式。
  • 导航图标 · 基础用法 2:可交互查看这一用法的行为,复制代码时保留它实际使用的属性与导入。

API 与上游详细参考

优先使用 0.7.1 官方中文说明;上游尚未提供中文的条目保留英文。属性名、类型及默认值保持原生 API,不把示例状态名称当成组件属性。

NavIcon is a circular icon container with an accent-colored background. Use it in navigation headers such as TopNavHeading and PageNavHeader to visually identify a section or application.

属性类型默认值说明
icon *ReactNode在圆形背景内渲染的图标元素。应为 Icon 或类似的图标组件。

使用建议

  • Use in navigation headers to provide a recognizable visual anchor for the section.
  • Pass an Icon or similarly sized icon component to ensure proper proportions.
  • 避免:Use NavIcon for interactive purposes; it is a display-only container, not a button.

主题 API

{
  "targets": [
    {
      "className": "astryx-nav-icon"
    }
  ]
}

组件结构

  • Container: Circular painted container for the supplied icon.
  • Icon: Caller-supplied visual content rendered inside the container.