breadcrumb · minimal · 灵感来源:Refactoring UI(文字层级 + 下划线反馈)
前两级可点,当前位置不可点
长标签:每级都能截断,不把行撑破
Breadcrumb · 极简面包屑 · 面包屑 / Minimal
做一个 Breadcrumb(极简面包屑):
- 同一份 props(items)
- 层级靠文字色区分,悬停只加下划线
- 语义结构同玻璃面包屑
用这些 CSS 变量:--color-text --color-text-muted --color-text-subtle
灵感参考:Refactoring UI(文字层级 + 下划线反馈)--color-text --color-text-muted --color-text-subtle
焦点
(尚未接进整页场景)
/r/breadcrumb--minimal.json
免外壳的 markdown 版:/llms/components/breadcrumb--minimal.mdinterface Props {
items: { label: string; href?: string }[];
className?: string;
}
/** 面包屑:层级用 ol,当前位置用 aria-current,分隔符对读屏隐藏 */
export function MinimalBreadcrumb({ items, className = '' }: Props) {
return (
<nav aria-label="面包屑" className={className}>
<ol className="flex flex-wrap items-center gap-1.5 text-xs">
{items.map((item, i) => {
const last = i === items.length - 1;
return (
<li key={item.label} className="flex items-center gap-1.5 min-w-0">
{i > 0 && (
<span aria-hidden="true" className="text-[var(--color-text-subtle)]">
/
</span>
)}
{last || !item.href ? (
<span
aria-current={last ? 'page' : undefined}
className={`truncate ${last ? 'text-[var(--color-text)]' : 'text-[var(--color-text-muted)]'}`}
>
{item.label}
</span>
) : (
<a
href={item.href}
className="
truncate px-1 -mx-1 rounded
text-[var(--color-text-muted)] hover:text-[var(--color-text)]
transition-colors hover:underline
"
>
{item.label}
</a>
)}
</li>
);
})}
</ol>
</nav>
);
}
src/components/breadcrumb/minimal/