极简徽标

badge · minimal · 灵感来源:Refactoring UI(发丝边 + 文字色做语义)

四种语义

草稿审核中已发布需修改

只留状态点(文字给读屏)

在线忙碌离线

复用卡

Status Badge · 极简徽标 · 徽标 / Minimal

规格 · 术语提示词(给 AI 用)

做一个 Status Badge(极简徽标):
- 同一份 props(variant / dot)
- 实底 + 发丝边,没有模糊
- 语义只落在文字色;dot 的文字同样走 sr-only
用这些 CSS 变量:--color-accent --color-divider --color-success-fg --color-surface --color-text-muted --color-warning-fg --text-2xs
灵感参考:Refactoring UI(发丝边 + 文字色做语义)

参数(CSS 变量)

--color-accent --color-divider --color-success-fg --color-surface --color-text-muted --color-warning-fg --text-2xs

必缺状态

(无必缺状态)

整页场景

(尚未接进整页场景)

安装(一条链接)

调研笔记

极简徽标

  • 与玻璃徽标同一份 props(variant / dot)
  • 实底 + --color-divider 发丝边,没有模糊;语义仍只落在文字色上
  • dot 的读屏文案与玻璃徽标一致:颜色之外必须有可读的状态名

实现

badge/minimal
import { type ReactNode } from 'react';

interface Props {
  children: ReactNode;
  variant?: 'neutral' | 'accent' | 'success' | 'warning';
  /** 只显示状态点:文字退成读屏可见 */
  dot?: boolean;
  className?: string;
}

const TONE = {
  neutral: 'text-[var(--color-text-muted)]',
  accent: 'text-[var(--color-accent)]',
  success: 'text-[var(--color-success-fg)]',
  warning: 'text-[var(--color-warning-fg)]',
};

export function MinimalBadge({ children, variant = 'neutral', dot = false, className = '' }: Props) {
  return (
    <span
      className={`
        inline-flex items-center gap-1.5
        px-2 py-0.5 rounded-full
        text-[length:var(--text-2xs)] font-mono
        bg-[var(--color-surface)] border border-[var(--color-divider)]
        ${TONE[variant]}
        ${className}
      `}
    >
      <span className="size-1.5 rounded-full bg-current" aria-hidden="true" />
      <span className={dot ? 'sr-only' : undefined}>{children}</span>
    </span>
  );
}

元信息

标识
badge/minimal
状态
done
最后提交
2026-11-01
风格轴
minimal
依赖 token
--color-accent --color-divider --color-success-fg --color-surface --color-text-muted --color-warning-fg --text-2xs
在工作台打开 源码与 notes 都在 src/components/badge/minimal/