组件 · 设置 · 原生 HTML 与 React
设置组 SettingsGroup
设置页的一组:组名 + 若干行(标题、说明、控件)。
演示
写入
写入标题
第一行 # 标题作为文章标题
写入
写入标题
第一行 # 标题作为文章标题
本地图片文件夹
未连接
<section class="xxd-group">
<h2 class="xxd-group__title">写入</h2>
<div class="xxd-group__body">
<div class="xxd-row">
<div class="xxd-row__text"><div class="xxd-row__title">写入标题</div><div class="xxd-row__desc">第一行 # 标题作为文章标题</div></div>
<div class="xxd-row__control"><input type="checkbox" role="switch" class="xxd-switch" aria-label="写入标题"></div>
</div>
</div>
</section>export function SettingsGroupDemo() {
const [on, setOn] = useState(true);
return (
<Settings style={{ maxWidth: 420 }}>
<SettingsGroup title="写入">
<SettingsRow title="写入标题" description="第一行 # 标题作为文章标题" control={<input type="checkbox" role="switch" className="xxd-switch" aria-label="写入标题" checked={on} onChange={(e) => setOn(e.target.checked)} />} />
<SettingsRow title="本地图片文件夹" description="未连接" href="#" />
</SettingsGroup>
</Settings>
);
}属性与类名
| 属性 / 类名 | 说明 |
|---|---|
| 类名 | xxd-settings xxd-group xxd-group__title xxd-group__body xxd-group__note xxd-row xxd-row__text xxd-row__title xxd-row__desc xxd-row__control |
键盘与读屏
- 组名用 h2(在页面 h1 下面),控件的 aria-label 和行标题一致
- 说明文字可以用 aria-describedby 连到控件
规则
- 灰色小标题 + 一个带框的主体,行之间细线
- 整个 tab 外面不画框
- a.xxd-row 整行可点,自动带 chevron
- §5