跳到正文
简体中文
「功能网格」包含在 Pro 里,开通会员后显示预览。

用法

import { LandingFeatures } from './LandingFeatures.jsx'

// Your own features: each tile is data; `demo` is any element (or a function of the feature),
// and a tile without one lists its points. Tones: 'accent' | 'secondary' | 'tertiary'.
<LandingFeatures
  locale="en"
  labels={{ title: 'Brew better coffee', titleQuiet: ' cup after cup.' }}
  features={[
    { id: 'log', icon: 'cup', title: 'Log every brew', text: 'Dose, grind and time in one tap.', points: ['Recipes saved', 'Timer built in'] },
    { id: 'taste', icon: 'star', tone: 'tertiary', title: 'Rate the taste', text: 'See what changed.', demo: <TasteChart /> },
  ]}
/>

// Or keep the four built-in demos of the sample app and feed them your numbers:
<LandingFeatures
  locale="en"
  schedule={plants}            // [{ id, name, from, every: { summer, winter } }]
  rooms={rooms}                // [{ id, name, value }]  humidity in %
  journal={entries}            // [{ id, date, note, leaves }]
  onExplore={(feature, value) => track('feature-demo', { feature, value })}
/>

属性

属性类型默认值作用
locale'en' | 'zh-CN' | 'es' | 'ja''en'内置文字和示例数据的语言。
featuresArray<{ id, icon?, title, text, tone?: 'accent' | 'secondary' | 'tertiary', span?: 2 | 3 | 4 | 6, demo?: ReactNode | (feature) => ReactNode | 'season' | 'light' | 'humidity' | 'journal', points?: string[] }>the four sample demos功能卡片。`demo` 是你自己的元素,或某个内置演示的名字;没有 demo 的卡片会列出 `points`。`span` 是它在六列中占几列(不填按数量自动排)。`icon` 是 kit 里的图标名。
scheduleArray<{ id, name, from, every: { summer, winter } }>sample plants提醒演示里的植物:第一次浇水是哪天,以及每个季节隔几天浇一次。
roomsArray<{ id, name, value }>sample rooms湿度演示里的房间及其湿度百分比。
journalArray<{ id, date, note, leaves }>sample entries日记条目;每条对应的画中植物会长出 `leaves` 片叶子。
season / distance'summer' | 'winter' / number'summer' / 1.5季节和光照演示的初始值。
onExplore(feature, value) => void—访客试用某个演示时调用:season、light、humidity 或 journal,以及选中的值。
labelsobject—替换任意内置文字(键名见 copy.js)。
classNamestring—加在根元素 section 上。

装进你的项目

Pro 包含这个区块的完整源码。复制指令,让你的 Agent 把它安装到项目中。

LandingFeatures.jsxlanding-features.csscopy.jskit.jsxkit.cssui/rolling-number/ui/range-slider/ui/progress-ring/ui/sliding-tabs/tokens.cssREADME.md

区块本身、样式和文案、共用的 kit、用到的组件和 tokens.css 会一起装进同一个文件夹。