列表 List
选人、弹层列表、通知、搜索结果、管理列表这类竖排列表:ListRow 是列表行(默认桌面单行 36、双行 52,手机分别至少 48、64,或 content 放任意内容的复合行,可带行尾独立操作 actions),ListActionRow 是带行尾删除的紧凑行,都放在内缩容器 ListBox 里。
状态:stable · 组件:ListRow、ListBox、ListActionRow、ChoiceList、TouchAction、TouchGroup、TouchRow
引入
定位到「引入」import { ListRow, ListBox, ListActionRow, ChoiceList, TouchAction, TouchGroup, TouchRow } from 'nacre'用法
定位到「用法」ListBox 内缩 6、行间 2;ListRow 给 title,可点的行给 onPress。
import { View, signal } from 'nsh'import { ListBox, ListRow, TOUCH } from 'nacre'
export function ListUsage() { const picked = signal('hk') const teams = [ { id: 'hk', name: '香港团队' }, { id: 'sg', name: '新加坡团队' }, { id: 'vip', name: '高净值专线' }, ] return ( <View class={`${TOUCH ? 'w-full' : 'w-[240px] max-w-full rounded-xl border border-border'}`}> <ListBox> {teams.map((team) => ( <ListRow title={team.name} selected={picked() === team.id} onPress={() => picked.set(team.id)} /> ))} </ListBox> </View> )}示例
定位到「示例」手机分组与行尾按钮
定位到「手机分组与行尾按钮」只读行里只让收藏按钮响应点按。归档后行和按钮一起禁用。
import { signal } from 'nsh'import { Icon, Swap, TouchAction, TouchGroup, TouchRow } from 'nacre'
export function ListTouchActions() { const pinned = signal(false) const label = () => pinned() ? '取消收藏' : '收藏' const archived = () => '已归档' return <TouchGroup> <TouchRow label={label()} trailing={<TouchAction testID="demo-touch-action" label={label()} onPress={() => pinned.update((v) => !v)}> {/* 开关类图标:开态换实心 + 品牌色,换态时弹一下(Swap toggle);不只换颜色 */} <Swap value={pinned()} motion="toggle"> <Icon name={pinned() ? 'star-filled' : 'star'} size={22} color={pinned() ? 'brand-text' : 'muted-foreground'} /> </Swap> </TouchAction>} /> <TouchRow disabled label={archived()} trailing={<TouchAction disabled label={label()} onPress={() => {}}> <Icon name="star" size={22} color="muted-foreground" /> </TouchAction>} /> </TouchGroup>}手机复合行
定位到「手机复合行」TouchRow 的 content 替换标题与说明那一列,放记录卡、小记、「字段名 + 值」这类自己排版的内容;上下各 12,行尾箭头与按下高亮照常。读屏名用 accessibilityLabel 给,不给就念内容里的文字。行被 LongPressMenu 这类包裹层包着时,外层带 touchSeparator() 画线并负责左缩进,行传 separatorByParent;直接放在 TouchGroup 里的行不传。
import { Text, View, signal } from 'nsh'import { TEXT_SIZE, TouchGroup, TouchRow } from 'nacre'
export function ListTouchContent() { const opened = signal('') return <TouchGroup> <TouchRow testID="demo-touch-content" chevron onPress={() => opened.set('note')} content={ <View testID="demo-touch-content-body" class="gap-1.5"> <View class="flex-row items-center gap-2"> <Text class={`flex-1 ${TEXT_SIZE.body} font-semibold text-foreground`}>已解决</Text> <Text class={`${TEXT_SIZE.small} text-text-tertiary tabular-nums`}>11-26 14:02</Text> </View> <Text class={`${TEXT_SIZE.small} text-muted-foreground`}>港股开户 / 资料补充</Text> <Text class={`${TEXT_SIZE.body} text-foreground`}>客户已补交住址证明,待复核。</Text> </View> } /> <TouchRow testID="demo-touch-field" content={ <View class="flex-row items-start gap-3"> <Text class={`w-[88px] shrink-0 ${TEXT_SIZE.body} text-muted-foreground`}>联系电话</Text> <Text class={`flex-1 min-w-0 ${TEXT_SIZE.body} text-foreground tabular-nums`}>+852 9123 4567</Text> </View> } /> <If when={opened()}> <Text testID="demo-touch-opened" class={`px-4 py-2 ${TEXT_SIZE.small} text-muted-foreground`}>已打开</Text> </If> </TouchGroup>}常驻的搜索选择列表
定位到「常驻的搜索选择列表」搜索只过滤候选,所选值由表单持有。single 即时单选,multiple 即时多选,tags 在勾选列表下提供可移除标签。禁选项不能选择或移除,删除钮读出对应选项名。
import { View, signal } from 'nsh'import { ChoiceList } from 'nacre'
export function InlineChoices() { const selected = signal<string[]>([]) const options = [ { value: 'hk', label: '香港' }, { value: 'sg', label: '新加坡' }, ] return ( <View class="w-60"> <ChoiceList mode="tags" height={88} testID="demo-choices" options={options} value={selected()} onChange={(next) => selected.set(next)} placeholder="搜索地区" emptyText="没有匹配地区" /> </View> )}多选与禁用
定位到「多选与禁用」选中用 selected(底色 + 行尾勾);头像放 leading,行尾放 trailing,trailingWidth 固定宽、不挤文字;禁用行不可点。
import { Text, View, signal } from 'nsh'import { Avatar, Icon, ListBox, ListRow, TEXT_SIZE } from 'nacre'
const agents = () => [ { id: 'a', name: '林嘉怡', busy: false }, { id: 'b', name: '陈智源', busy: false }, { id: 'c', name: 'Michael Wong', busy: false }, { id: 'd', name: '周可欣', busy: true },]
export function ListSelectable() { const AGENTS = agents() const picked = signal<string[]>(['a']) const toggle = (id: string) => picked.update((list) => (list.includes(id) ? list.filter((v) => v !== id) : [...list, id])) const names = () => AGENTS.filter((agent) => picked().includes(agent.id)).map((agent) => agent.name) return ( <View class="flex-row flex-wrap items-start gap-3"> <View class="w-[280px] max-w-full rounded-xl border border-border"> <ListBox> {AGENTS.map((agent) => ( <ListRow testID={`list-${agent.id}`} title={agent.name} leading={<Avatar name={agent.name} size={22} />} selected={picked().includes(agent.id)} disabled={agent.busy} onPress={() => toggle(agent.id)} trailingWidth={agent.busy ? 44 : 16} trailing={agent.busy ? <Text class={`${TEXT_SIZE.caption} text-muted-foreground`}>已在</Text> : picked().includes(agent.id) ? <Icon name="check" size={14} color="selection-indicator" /> : undefined} /> ))} </ListBox> </View> <Text class={`${TEXT_SIZE.small} text-muted-foreground`}>{`$已选:${names().join('、') || '无'}`}</Text> </View> )}带行尾操作
定位到「带行尾操作」ListActionRow:点行套用,行尾 IconButton 删除,两者互不触发;sm 28(默认)/ md 36。
import { Text, View, signal } from 'nsh'import { IconButton, ListActionRow, ListBox, TEXT_SIZE } from 'nacre'
export function ListActionRows() { const views = signal([ '有效会话', '本周差评', '港股开户 · 未解决 · 近 30 天 · 二线', ]) const applied = signal('') // 删掉的正好是已套用的视图:套用一并清掉,不留指向已删视图的状态 const remove = (name: string) => { views.update((list) => list.filter((v) => v !== name)) if (applied() === name) applied.set('') } return ( <View class="flex-row flex-wrap items-start gap-3"> <View class="w-[260px] max-w-full rounded-xl border border-border"> <ListBox> <Each of={views()} key={(name) => name}> {(name) => ( <ListActionRow testID={`action-row-${name()}`} title={name()} selected={applied() === name()} onPress={() => applied.set(name())} action={<IconButton icon="close" size="xs" label="删除" testID={`action-row-delete-${name()}`} onPress={() => remove(name())} />} /> )} </Each> <ListActionRow title="管理员共享的视图" disabled onPress={() => {}} action={<IconButton icon="close" size="xs" label="删除" disabled onPress={() => {}} />} /> </ListBox> </View> <Text class={`${TEXT_SIZE.small} text-muted-foreground`}>{`$已套用:${applied() || '无'}`}</Text> </View> )}两行与截断
定位到「两行与截断」有 subtitle 就是 52 的两行行;标题与副文案各自单行截断,标题悬停看全文。
手机:有 subtitle 就是两行行(手机至少 64);标题与副文案各自单行截断。
import { View } from 'nsh'import { Avatar, ListBox, ListRow, TOUCH } from 'nacre'
export function ListTwoLine() { return ( <View class={`${TOUCH ? 'w-full' : 'w-[280px] max-w-full rounded-xl border border-border'}`}> <ListBox> <ListRow title="林嘉怡" subtitle="港股开户 · 一线" leading={<Avatar name="林嘉怡" size={22} />} onPress={() => {}} /> <ListRow title="Michael Wong(客服主管,负责港美股开户与资金问题的二线支持)" subtitle="二线支持 · 资金与出入金 · 港股美股 · 夜班" leading={<Avatar name="Michael Wong" size={22} />} onPress={() => {}} /> <ListRow title="陈智源" leading={<Avatar name="陈智源" size={22} />} onPress={() => {}} /> </ListBox> </View> )}复合行
定位到「复合行」content 放任意内容(标题 + 时间 + 两行摘要 + 标签),leading 贴顶;actions 是行尾独立操作,手机上常显,桌面悬停或行内有焦点时显现,按下不触发行;onContextMenu 接右键。
手机:content 放任意内容(标题 + 时间 + 两行摘要 + 标签),leading 贴顶;行尾操作在手机上常显,按下不触发行。
import { Text, View, signal } from 'nsh'import { Icon, IconButton, ListBox, ListRow, Tag, TEXT_SIZE, TOUCH } from 'nacre'
const notices = () => [ { id: 'n1', title: '港股开户流程更新', body: '自 12 月 1 日起,港股开户需要补充税务居民身份声明,请在会话中提醒客户上传。', at: '14:32', tag: '重要', }, { id: 'n2', title: '今晚 22:00 系统维护', body: '维护期间会话会自动转入留言,预计 30 分钟。', at: '昨天', },]
export function ListCompound() { const NOTICES = notices() const opened = signal('n1') const last = signal('') return ( <View class="flex-row flex-wrap items-start gap-3"> <View class="w-[340px] max-w-full rounded-xl border border-border"> <ListBox> {NOTICES.map((notice) => ( <ListRow testID={`compound-${notice.id}`} accessibilityLabel={[notice.title, notice.at, notice.tag, notice.body].filter(Boolean).join(' · ')} selected={opened() === notice.id} onPress={() => opened.set(notice.id)} onContextMenu={() => last.set(`$右键:${notice.title}`)} leading={ <View class="w-8 h-8 rounded-lg items-center justify-center bg-muted"> <Icon name="bell" size={16} color="muted-foreground" /> </View> } content={ <View class="gap-0.5"> <View class="flex-row items-center gap-2 h-5"> <Text class={`flex-1 min-w-0 truncate ${TEXT_SIZE.body} font-medium text-foreground`}>{notice.title}</Text> <Text class={`shrink-0 ${TEXT_SIZE.small} text-muted-foreground tabular-nums`}>{notice.at}</Text> </View> <Text class={`${TEXT_SIZE.smallLoose} text-muted-foreground line-clamp-2`}>{notice.body}</Text> {notice.tag ? ( <View class="flex-row pt-0.5"> <Tag variant="soft" tone="warning" label={notice.tag} /> </View> ) : undefined} </View> } actions={<IconButton icon="trash" size="xs" label="删除" testID={`compound-delete-${notice.id}`} onPress={() => last.set(`$删除:${notice.title}`)} />} /> ))} </ListBox> </View> <Text class={`${TEXT_SIZE.small} text-muted-foreground`}>{last() || (TOUCH ? '点行尾按钮试试' : '悬停看操作,右键试试')}</Text> </View> )}选中与当前项
定位到「选中与当前项」selected 是持久选中(selection 底,读「已选中」);current 是临时高亮(读「当前项」):默认 highlight 淡底,只做业务定位;建议列表里键盘移到的项是唯一的当前项指示,加 currentTone=“strong”(menu-current 淡品牌底,与菜单当前行一致,不加内环)。size=“sm” 是 32 的紧凑行。
手机:selected 是持久选中(selection 底,读「已选中」);current 是临时高亮(highlight 淡底),只做业务定位。
import { View, signal } from 'nsh'import { Icon, ListBox, ListRow } from 'nacre'
export function ListSelectedCurrent() { const items = ['您好,请问有什么可以帮您?', '请稍等,我帮您查询一下。', '感谢您的耐心等待。'] const current = signal(1) return ( <View class="flex-row flex-wrap items-start gap-3"> <View class="w-[300px] max-w-full rounded-xl border border-border"> <ListBox> <ListRow testID="sc-selected" title="香港团队(已选中)" selected onPress={() => {}} trailing={<Icon name="check" size={14} color="selection-indicator" />} /> </ListBox> </View> <View class="w-[300px] max-w-full rounded-xl border border-border"> <ListBox> {items.map((text, index) => ( <ListRow testID={`sc-current-${index}`} size="sm" title={text} current={current() === index} currentTone="strong" onPress={() => current.set(index)} /> ))} </ListBox> </View> </View> )}管理列表
定位到「管理列表」排序、改名、删除放 actions,revealActions=“always” 一直显示;没有 onPress 的行不是按钮,只有操作可点。
import { View, signal } from 'nsh'import { IconButton, ListBox, ListRow, TOUCH } from 'nacre'
export function ListManage() { const names = signal(['开户', '出入金', '交易']) const move = (index: number, offset: -1 | 1) => names.update((list) => { const next = [...list] const [item] = next.splice(index, 1) next.splice(index + offset, 0, item as string) return next }) return ( <View class={`${TOUCH ? 'w-full' : 'w-[300px] max-w-full rounded-xl border border-border'}`}> <ListBox> <Each of={names()} key={(name) => name}> {(name, index) => ( <ListRow testID={`manage-${index()}`} size="sm" title={name()} revealActions="always" actions={ <> <IconButton icon="chevron-up" size="xs" label="上移" testID={`manage-up-${index()}`} disabled={index() === 0} onPress={() => move(index(), -1)} /> <IconButton icon="chevron-down" size="xs" label="下移" disabled={index() === names().length - 1} onPress={() => move(index(), 1)} /> <IconButton icon="trash" size="xs" label="删除" onPress={() => names.update((list) => list.filter((v) => v !== name()))} /> </> } /> )} </Each> </ListBox> </View> )}禁用的复合行
定位到「禁用的复合行」disabled 时整行 40% 透明,不可点,不进 Tab 序列。
手机:disabled 时行内容降到 40%,不可点。
import { Text, View } from 'nsh'import { ListBox, ListRow, TEXT_SIZE, TOUCH } from 'nacre'
export function ListDisabledCompound() { return ( <View class={`${TOUCH ? 'w-full' : 'w-[300px] max-w-full rounded-xl border border-border'}`}> <ListBox> <ListRow testID="compound-disabled" accessibilityLabel="已归档的公告" disabled onPress={() => {}} content={<Text class={`${TEXT_SIZE.body} text-foreground`}>已归档的公告</Text>} /> </ListBox> </View> )}固定行高
定位到「固定行高」虚拟列表要行等高时给 height(会话列表 64):不再按内容撑高,头像与内容垂直居中;onHoverChange 报悬停进出,content 里只在悬停时显现的次要提示用它。
手机:虚拟列表要行等高时给 height(会话列表 64):不再按内容撑高,头像与内容垂直居中。
import { Text, View, signal } from 'nsh'import { Avatar, ListBox, ListRow, TEXT_SIZE, TOUCH } from 'nacre'
export function ListFixedHeight() { const rows = [ { id: 'f1', name: '林嘉怡', preview: '好的,我把资料补上', at: '14:32' }, { id: 'f2', name: 'Michael Wong', preview: '请问港股开户需要多久?', at: '昨天' }, ] const opened = signal('f1') const hovered = signal('') return ( <View class={`${TOUCH ? 'w-full' : 'w-[300px] max-w-full rounded-xl border border-border'}`}> <ListBox> {rows.map((row) => ( <ListRow testID={`fixed-${row.id}`} accessibilityLabel={[row.name, row.at, row.preview].join(' · ')} height={64} selected={opened() === row.id} onPress={() => opened.set(row.id)} onHoverChange={(on) => hovered.set(on ? row.id : hovered() === row.id ? '' : hovered())} leading={<Avatar name={row.name} size={40} />} content={ <View class="gap-0.5"> <View class="h-5 flex-row items-center gap-1.5"> <Text class={`flex-1 min-w-0 truncate ${TEXT_SIZE.body} font-medium text-foreground`}>{row.name}</Text> <Text testID={`fixed-hint-${row.id}`} class={`shrink-0 ${TEXT_SIZE.small} text-muted-foreground`} classList={{ 'opacity-0': hovered() !== row.id }}> 悬停 </Text> <Text class={`shrink-0 ${TEXT_SIZE.small} text-muted-foreground tabular-nums`}>{row.at}</Text> </View> <Text class={`truncate ${TEXT_SIZE.small} text-muted-foreground`}>{row.preview}</Text> </View> } /> ))} </ListBox> </View> )}键盘
定位到「键盘」| 键 | 行为 |
|---|---|
| Tab | 在可点的行(以及行尾操作)之间移动 |
| Space / Return | 按下当前行 |
| Shift+F10 | 在聚焦的行上打开右键菜单(onContextMenu) |
无障碍
定位到「无障碍」- 给了 onPress 的 ListRow 是 button,selected 读作已选中;没有 onPress 的行只是文字。
- ListRow 不给 accessibilityLabel 时读行内文字;ListActionRow 默认读标题。
- ListActionRow 的行尾操作是独立的按钮,要有自己的 label(「删除」)。
- 禁用行不进 Tab 序列,40% 透明。
- selected 读作「已选中」,current 读作「当前项」(aria-current),两者外观也不同:selection 底 / highlight 底(currentTone=“strong” 时 menu-current 淡品牌底,不被 selected 盖住)。
- 行内操作各自有名称,Tab 在行之后依次进入。自定义复合行的读屏名包含标题、时间及可见摘要,保持与行内独立操作分开。
该用 / 不该用
定位到「该用 / 不该用」该用
- ListRow 一律放在 ListBox 里
- 长标题截断并悬停看全文
- 行尾状态用固定的 trailingWidth
- 行内的编辑、删除放 actions,不塞进 content
不该用
- 行内放多个主按钮
- 悬停改高度
- 在行上自己写 p-1 / mx-1 内缩
- 在 content 里放按钮(按钮套按钮)
- 给行传底色类:状态外观由 selected / current / disabled 决定
API
定位到「API」ListRow
定位到「ListRow」| 属性 | 类型 | 默认 | 说明 |
|---|---|---|---|
title |
string |
— | 标题模式:单行标题(与 content 二选一) |
subtitle |
string |
— | 第二行(分组、说明)。默认双行桌面 52、手机至少 64,单行桌面 36、手机至少 48 |
content |
JSX.Element |
— | 复合模式:任意内容(多行标题 + 摘要 + 标签),替代 title / subtitle;字色字号由内容自己定,底色、焦点环、按下态仍由行管 |
leading |
JSX.Element |
— | 头像、状态点、图标。标题模式按整行垂直居中;复合模式(content)贴顶,和首行对齐 |
trailing |
JSX.Element |
— | 勾选、计数、状态:固定宽的 lane,不随内容挤动文字;在主点击区之内 |
trailingWidth |
number |
16 |
|
actions |
JSX.Element |
— | 独立操作(编辑、删除、排序):一般是 IconButton。渲染在主点击区之外、同一行的右端,按下不触发行的 onPress, 各自是 Tab 停靠点;默认悬停或行内有焦点时才显现(revealActions)。主点击区给它让出宽度,文字不钻到按钮底下 |
revealActions |
'hover' | 'always' |
— | 桌面端操作何时显现:hover(默认,悬停或行内有焦点时)/ always(常显);手机常显 |
size |
'md' | 'sm' |
— | md 默认,标题模式桌面单行 36 / 双行 52,手机至少 48 / 64。sm 紧凑行桌面 32、手机 44 |
height |
number |
— | 固定行高(虚拟列表要等高的行,如会话列表 64):不再按内容撑高、不加上下内边距,内容与 leading 垂直居中;size=“sm” 时不生效 |
selected |
boolean |
— | 持久选中(多选、当前打开的项):selection 底,读屏念「已选中」 |
current |
boolean |
— | 临时高亮(业务定位、键盘在建议列表里移到的当前项):读屏念「当前项」;样子看 currentTone |
currentTone |
'subtle' | 'strong' |
— | current 的样子。subtle(默认):highlight 淡底,只做业务定位,和 selected 同时给时按 selected 画。 strong:menu-current 淡品牌底(不加内环,同菜单当前行),行是建议列表里唯一的键盘当前项指示时用(行不拿焦点、没有焦点环可依靠); 不被 selected 盖住,标题与副文案换 menu-current-foreground,复合模式(content)里的文字与图标由调用方按 current 换成 menu-current-foreground |
disabled |
boolean |
— | |
focusable |
boolean |
— | 没有 onPress 也要进 Tab 序列时给 true;给了 onPress 默认就是停靠点 |
role |
'button' | 'link' |
'button' |
button(默认,有 onPress 时)/ link(打开外部页面) |
onPress |
() => void |
— | |
onContextMenu |
(e: ContextMenuEvent) => void |
— | 右键 / Shift+F10:在 e.pagePosition 弹菜单;落在 actions 上的右键不会到这里 |
onHoverChange |
(hovered: boolean) => void |
— | 悬停进出整行(含 actions):content 里只在悬停时显现的次要控件用它;行尾独立操作直接放 actions |
onFocus |
() => void |
— | 主点击区拿到 / 失去键盘焦点 |
onBlur |
() => void |
— | |
viewRef |
(node: ViewRef) => void |
— | 主点击区的 ref(滚到可见、程序聚焦) |
tooltip |
string |
— | 悬停提示(复合模式用;标题模式自动给标题提示) |
accessibilityLabel |
string |
— | 读屏名;不给时读屏念行内文字 |
testID |
string |
— | 给主点击区(按下、读屏、焦点都在它上面) |
* 必填
ListBox
定位到「ListBox」| 属性 | 类型 | 默认 | 说明 |
|---|---|---|---|
class |
string |
— | |
testID |
string |
— | |
children |
JSX.Element |
— |
* 必填
ListActionRow
定位到「ListActionRow」| 属性 | 类型 | 默认 | 说明 |
|---|---|---|---|
title * |
string |
— | |
onPress * |
() => void |
— | |
action * |
JSX.Element |
— | 行尾的独立操作(删除、移除):一般是 IconButton size="xs";和行本体并排,不套在行按钮里 |
size |
'sm' | 'md' |
— | sm 28、12pt(浮层里的紧凑列表,默认);md 36、13pt(同 ListRow 单行) |
selected |
boolean |
— | |
disabled |
boolean |
— | |
accessibilityLabel |
string |
— | 读屏名;不给时读标题 |
testID |
string |
— | |
class |
string |
— | 根节点的布局类 |
* 必填
ChoiceList
定位到「ChoiceList」| 属性 | 类型 | 默认 | 说明 |
|---|---|---|---|
options * |
readonly ChoiceListOption[] |
— | |
value * |
readonly string[] |
— | |
onChange * |
(value: string[]) => void |
— | |
mode |
'single' | 'multiple' | 'tags' |
— | single 单选、multiple 多选、tags 多选并显示已选标签。默认 single。 |
fallbackNames |
Readonly<Record<string, string>> |
— | |
placeholder * |
string |
— | |
emptyText * |
string |
— | |
loadingText |
string |
— | |
disabledText |
string |
— | |
heading |
string |
— | |
invalid |
boolean |
— | |
height |
number |
220 |
|
limit |
number |
— | |
testID |
string |
— |
* 必填
TouchAction
定位到「TouchAction」| 属性 | 类型 | 默认 | 说明 |
|---|---|---|---|
label * |
string |
— | |
onPress * |
() => void |
— | |
testID |
string |
— | |
disabled |
boolean |
— | |
expanded |
boolean |
— | |
children * |
JSX.Element |
— |
* 必填
TouchGroup
定位到「TouchGroup」| 属性 | 类型 | 默认 | 说明 |
|---|---|---|---|
testID |
string |
— | |
title |
string |
— | |
hint |
string |
— | |
children |
JSX.Element |
— |
* 必填
TouchRow
定位到「TouchRow」| 属性 | 类型 | 默认 | 说明 |
|---|---|---|---|
testID |
string |
— | |
label |
string |
— | 标题;给了 content 时可省 |
description |
string |
— | 标题下面的说明或所属路径。长文字换行,整行随内容增高。 |
leading |
JSX.Element |
— | 行首(色点、图标),宽度由调用方给 |
detail |
string |
— | 行尾的说明文字(当前值、接待量),灰字 |
detailClass |
string |
'text-muted-foreground' |
|
trailing |
JSX.Element |
— | 行尾自定义内容(开关) |
checked |
boolean |
— | 选中项右侧打勾;默认单选,复选行传 checkRole=“checkbox” |
checkRole |
'checkbox' | 'radio' |
'radio' |
|
chevron |
boolean |
— | 进入下一级:右侧箭头 |
destructive |
boolean |
— | |
disabled |
boolean |
— | |
onPress |
() => void |
— | |
pressedByParent |
boolean |
— | 点按由外层接(MenuTrigger 加 group 和 touchSeparator()):分隔线由外层画,按下高亮跟外层走,仍铺满整宽 |
content |
JSX.Element |
— | 复合内容,替换标题与说明那一列(记录卡、小记、字段名 + 值):上下各 12,宽度占满,行首、行尾、箭头照常。 内容自己排版,字号走 TEXT_SIZE;读屏名用 accessibilityLabel 给,不给就念内容里的文字。 |
accessibilityLabel |
string |
— | |
separatorByParent |
boolean |
— | 分隔线与左缩进由外层负责:行被 LongPressMenu 这类包裹层包着时,外层带 touchSeparator() 画线并吃掉左 16,行不再画线。 行被包住后永远是包裹层的唯一子元素,自己画的线会被 last:pb-0 吃掉,所以必须交给外层。直接放在 TouchGroup 里的行不要传。 |
* 必填