baseline-ui

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Baseline UI

UI基准规范

Enforces an opinionated UI baseline to prevent AI-generated interface slop.
强制执行一套自定义的UI基准规范,以避免AI生成的界面出现杂乱问题。

How to use

使用方法

  • /baseline-ui
    Apply these constraints to any UI work in this conversation.
  • /baseline-ui <file>
    Review the file against all constraints below and output:
    • violations (quote the exact line/snippet)
    • why it matters (1 short sentence)
    • a concrete fix (code-level suggestion)
  • /baseline-ui
    将这些约束应用于本次对话中的所有UI工作。
  • /baseline-ui <file>
    根据以下所有约束审查文件,并输出:
    • 违规内容(引用确切的代码行/片段)
    • 违规影响(一句话简述)
    • 具体修复方案(代码层面的建议)

Stack

技术栈

  • MUST use Tailwind CSS defaults unless custom values already exist or are explicitly requested
  • MUST use
    motion/react
    (formerly
    framer-motion
    ) when JavaScript animation is required
  • SHOULD use
    tw-animate-css
    for entrance and micro-animations in Tailwind CSS
  • MUST use
    cn
    utility (
    clsx
    +
    tailwind-merge
    ) for class logic
  • 除非已有自定义值或被明确要求,否则必须使用Tailwind CSS默认值
  • 当需要JavaScript动画时,必须使用
    motion/react
    (原
    framer-motion
  • 对于Tailwind CSS中的入场动画和微动画,建议使用
    tw-animate-css
  • 类名逻辑必须使用
    cn
    工具(
    clsx
    +
    tailwind-merge

Components

组件

  • MUST use accessible component primitives for anything with keyboard or focus behavior (
    Base UI
    ,
    React Aria
    ,
    Radix
    )
  • MUST use the project’s existing component primitives first
  • NEVER mix primitive systems within the same interaction surface
  • SHOULD prefer
    Base UI
    for new primitives if compatible with the stack
  • MUST add an
    aria-label
    to icon-only buttons
  • NEVER rebuild keyboard or focus behavior by hand unless explicitly requested
  • 任何涉及键盘或焦点行为的组件,必须使用可访问的组件基础库(
    Base UI
    React Aria
    Radix
  • 必须优先使用项目现有的组件基础库
  • 切勿在同一交互界面中混合使用不同的基础库系统
  • 如果与技术栈兼容,新的基础库建议优先使用
    Base UI
  • 纯图标按钮必须添加
    aria-label
    属性
  • 除非被明确要求,切勿手动编写键盘或焦点行为逻辑

Interaction

交互

  • MUST use an
    AlertDialog
    for destructive or irreversible actions
  • SHOULD use structural skeletons for loading states
  • NEVER use
    h-screen
    , use
    h-dvh
  • MUST respect
    safe-area-inset
    for fixed elements
  • MUST show errors next to where the action happens
  • NEVER block paste in
    input
    or
    textarea
    elements
  • 对于破坏性或不可逆操作,必须使用
    AlertDialog
    组件
  • 加载状态建议使用结构化骨架屏
  • 切勿使用
    h-screen
    ,应使用
    h-dvh
  • 固定定位元素必须遵循
    safe-area-inset
    安全区域规则
  • 错误提示必须显示在操作发生的位置附近
  • 切勿禁止在
    input
    textarea
    元素中粘贴内容

Animation

动画

  • NEVER add animation unless it is explicitly requested
  • MUST animate only compositor props (
    transform
    ,
    opacity
    )
  • NEVER animate layout properties (
    width
    ,
    height
    ,
    top
    ,
    left
    ,
    margin
    ,
    padding
    )
  • SHOULD avoid animating paint properties (
    background
    ,
    color
    ) except for small, local UI (text, icons)
  • SHOULD use
    ease-out
    on entrance
  • NEVER exceed
    200ms
    for interaction feedback
  • MUST pause looping animations when off-screen
  • SHOULD respect
    prefers-reduced-motion
  • NEVER introduce custom easing curves unless explicitly requested
  • SHOULD avoid animating large images or full-screen surfaces
  • 除非被明确要求,否则切勿添加动画
  • 必须仅对合成器属性(
    transform
    opacity
    )执行动画
  • 切勿对布局属性(
    width
    height
    top
    left
    margin
    padding
    )执行动画
  • 除小型局部UI(文本、图标)外,建议避免对绘制属性(
    background
    color
    )执行动画
  • 入场动画建议使用
    ease-out
    缓动函数
  • 交互反馈动画时长切勿超过200ms
  • 当元素处于屏幕外时,必须暂停循环动画
  • 建议遵循
    prefers-reduced-motion
    (减少动画偏好)设置
  • 除非被明确要求,切勿自定义缓动曲线
  • 建议避免对大型图片或全屏元素执行动画

Typography

排版

  • MUST use
    text-balance
    for headings and
    text-pretty
    for body/paragraphs
  • MUST use
    tabular-nums
    for data
  • SHOULD use
    truncate
    or
    line-clamp
    for dense UI
  • NEVER modify
    letter-spacing
    (
    tracking-*
    ) unless explicitly requested
  • 标题必须使用
    text-balance
    ,正文/段落必须使用
    text-pretty
  • 数据内容必须使用
    tabular-nums
  • 对于密集型UI,建议使用
    truncate
    line-clamp
    进行文本截断
  • 除非被明确要求,切勿修改
    letter-spacing
    tracking-*

Layout

布局

  • MUST use a fixed
    z-index
    scale (no arbitrary
    z-*
    )
  • SHOULD use
    size-*
    for square elements instead of
    w-*
    +
    h-*
  • 必须使用固定的
    z-index
    层级体系(禁止使用任意的
    z-*
    值)
  • 对于方形元素,建议使用
    size-*
    而非
    w-*
    +
    h-*

Performance

性能

  • NEVER animate large
    blur()
    or
    backdrop-filter
    surfaces
  • NEVER apply
    will-change
    outside an active animation
  • NEVER use
    useEffect
    for anything that can be expressed as render logic
  • 切勿对大型
    blur()
    backdrop-filter
    区域执行动画
  • 切勿在非活跃动画场景下使用
    will-change
    属性
  • 任何可通过渲染逻辑实现的功能,切勿使用
    useEffect

Design

设计

  • NEVER use gradients unless explicitly requested
  • NEVER use purple or multicolor gradients
  • NEVER use glow effects as primary affordances
  • SHOULD use Tailwind CSS default shadow scale unless explicitly requested
  • MUST give empty states one clear next action
  • SHOULD limit accent color usage to one per view
  • SHOULD use existing theme or Tailwind CSS color tokens before introducing new ones
  • 除非被明确要求,否则切勿使用渐变效果
  • 切勿使用紫色或多色渐变
  • 切勿将发光效果作为主要交互提示
  • 除非被明确要求,建议使用Tailwind CSS默认阴影层级
  • 空状态必须提供一个明确的下一步操作
  • 建议每个视图中仅使用一种强调色
  • 在引入新颜色之前,建议优先使用现有主题或Tailwind CSS颜色令牌