extension-ui
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExtension UI
扩展UI
Build professional, polished Chrome extension interfaces. Do NOT just explain — execute the workflow.
打造专业、精致的Chrome扩展界面。不要仅停留在解释层面——请执行以下工作流。
Workflow (Execute This)
工作流(请执行)
Step 1: Detect context
步骤1:检测上下文
- Check framework: → React / Vue / Svelte / Vanilla
package.json - Check existing UI files: popup, sidepanel, options, content scripts
- Check if Tailwind / shadcn / DaisyUI already configured
- Identify extension type: popup-only, sidepanel, full options page
- 检查框架:→ React / Vue / Svelte / Vanilla
package.json - 检查现有UI文件:popup、sidepanel、options、内容脚本
- 检查是否已配置Tailwind / shadcn / DaisyUI
- 确定扩展类型:仅弹窗、侧边栏、完整选项页
Step 2: Analyze existing UI
步骤2:分析现有UI
If UI files exist:
- Read component files for layout, spacing, color usage
- Check for dark mode support (or
prefers-color-scheme)class="dark" - Check accessibility: semantic HTML, aria-labels, focus management
- Check for Chrome design language alignment
Report findings: what's good, what needs improvement, priority fixes.
若存在UI文件:
- 读取组件文件,分析布局、间距、颜色使用情况
- 检查深色模式支持(或
prefers-color-scheme)class="dark" - 检查无障碍性:语义化HTML、aria标签、焦点管理
- 检查是否贴合Chrome设计语言
输出分析结果:现有优势、待改进点、优先级修复项。
Step 3: Recommend UI stack
步骤3:推荐UI技术栈
| Framework | Recommended Stack |
|---|---|
| React | shadcn/ui + Tailwind (best component quality) |
| React (minimal) | Tailwind only + custom compact theme |
| Vue | DaisyUI + Tailwind |
| Svelte | Tailwind + svelte-headlessui |
| Vanilla | Custom CSS with CSS variables |
| 框架 | 推荐技术栈 |
|---|---|
| React | shadcn/ui + Tailwind(最佳组件质量) |
| React(轻量版) | 仅Tailwind + 自定义紧凑主题 |
| Vue | DaisyUI + Tailwind |
| Svelte | Tailwind + svelte-headlessui |
| Vanilla | 基于CSS变量的自定义CSS |
Step 4: Implement improvements
步骤4:实施改进
Apply fixes in priority order:
- Dark mode support (critical — many users use dark mode)
- Proper sizing constraints (see )
references/extension-ui-constraints.md - Typography and spacing for small surfaces
- Accessibility fixes (keyboard nav, aria, focus)
- Loading/error/empty states
- Animations (subtle, fast, purposeful)
按优先级顺序应用修复:
- 深色模式支持(关键——大量用户使用深色模式)
- 合理的尺寸限制(详见)
references/extension-ui-constraints.md - 小界面区域的排版与间距规范
- 无障碍修复(键盘导航、aria属性、焦点管理)
- 加载/错误/空状态处理
- 动画效果(细微、快速、有明确用途)
Extension UI Constraints (Summary)
扩展UI限制条件(摘要)
| Surface | Size | Key Constraints |
|---|---|---|
| Popup | max 800x600px | Closes on outside click, no resize |
| Sidepanel | 320-400px wide | Full height, persistent |
| Options page | Full tab | Standard web page |
| Content script UI | Injected | CSS isolation via shadow DOM |
Full details:
references/extension-ui-constraints.md| 界面区域 | 尺寸 | 核心限制 |
|---|---|---|
| 弹窗 | 最大800x600px | 点击外部关闭,不可调整大小 |
| 侧边栏 | 320-400px宽 | 全屏高度,持久显示 |
| 选项页 | 完整标签页 | 标准网页 |
| 内容脚本UI | 注入式 | 通过Shadow DOM实现CSS隔离 |
详细内容:
references/extension-ui-constraints.mdDark Mode (Required)
深色模式(必填)
Always implement dark mode. Extensions live in both light/dark browser themes.
css
/* CSS variables approach */
:root { --bg: #ffffff; --text: #111827; --border: #e5e7eb; }
@media (prefers-color-scheme: dark) {
:root { --bg: #1f2937; --text: #f9fafb; --border: #374151; }
}Store user preference override in .
chrome.storage.sync务必实现深色模式。扩展需适配亮色/深色浏览器主题。
css
/* CSS变量方案 */
:root { --bg: #ffffff; --text: #111827; --border: #e5e7eb; }
@media (prefers-color-scheme: dark) {
:root { --bg: #1f2937; --text: #f9fafb; --border: #374151; }
}将用户偏好设置存储在中。
chrome.storage.syncTypography for Small Surfaces
小界面区域的排版规范
- Base font: system font stack — no custom fonts (bundle size + render speed)
- Popup base size: 13-14px (readable without overflow)
- Line height: 1.4-1.5 (tighter than web default)
- Font weights: 400 (body), 500 (label), 600 (heading)
css
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;- 基础字体:系统字体栈——不使用自定义字体(减少包体积 + 提升渲染速度)
- 弹窗基础字号:13-14px(无需滚动即可清晰阅读)
- 行高:1.4-1.5(比网页默认更紧凑)
- 字体权重:400(正文)、500(标签)、600(标题)
css
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;Color Palette (Chrome-aligned)
Chrome风格配色方案
- Primary: (Google Blue) or brand color
#1a73e8 - Surface: /
#ffffffdark#1f2937 - Border: /
#dadce0dark#374151 - Text primary: /
#202124dark#f9fafb - Text secondary: /
#5f6368dark#9ca3af - Success: , Error:
#34a853, Warning:#d93025#fbbc04
- 主色调:(谷歌蓝)或品牌色
#1a73e8 - 背景色:/ 深色模式下
#ffffff#1f2937 - 边框色:/ 深色模式下
#dadce0#374151 - 正文主色:/ 深色模式下
#202124#f9fafb - 正文次要色:/ 深色模式下
#5f6368#9ca3af - 成功色:,错误色:
#34a853,警告色:#d93025#fbbc04
Animations
动画效果
- Duration: 100-200ms (popup feels instant)
- Easing: for entrances,
ease-outfor exitsease-in - Avoid layout-triggering animations (,
transformonly)opacity - Always respect
prefers-reduced-motion
css
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }- 时长:100-200ms(弹窗需给人即时响应的感觉)
- 缓动函数:入场用,退场用
ease-outease-in - 避免触发布局重排的动画(仅使用、
transform)opacity - 务必尊重设置
prefers-reduced-motion
css
@media (prefers-reduced-motion: reduce) { * { animation: none !important; } }Accessibility Checklist (Quick)
无障碍快速检查表
- Tab order logical, all interactive elements reachable
- Icon-only buttons have
aria-label - Color contrast 4.5:1 minimum
- Focus visible (not just removed)
:focus-visible - Semantic HTML (not
button,divfor nav)nav
Full checklist:
references/accessibility-checklist.md- 制表符顺序符合逻辑,所有交互元素均可通过键盘访问
- 仅含图标的按钮需添加
aria-label - 颜色对比度最低达到4.5:1
- 焦点可见(不可移除样式)
:focus-visible - 使用语义化HTML(用而非
button,导航用div)nav
完整检查表:
references/accessibility-checklist.mdReferences
参考资料
- — Size limits, layout patterns per surface
references/extension-ui-constraints.md - — shadcn/ui, DaisyUI, Tailwind setup
references/design-system-setup.md - — Loading, error, empty states, onboarding
references/ux-patterns.md - — Full a11y requirements and testing
references/accessibility-checklist.md
- — 各界面区域的尺寸限制与布局模式
references/extension-ui-constraints.md - — shadcn/ui、DaisyUI、Tailwind的配置方法
references/design-system-setup.md - — 加载、错误、空状态、引导流程等UX模式
references/ux-patterns.md - — 完整的无障碍需求与测试指南
references/accessibility-checklist.md
Related Skills
相关技能
- — Scaffold new extension with framework choice
extension-create - — Analyze existing extension codebase
extension-analyze - — Icons, images, asset optimization
extension-assets
- — 根据框架选择快速搭建新扩展
extension-create - — 分析现有扩展代码库
extension-analyze - — 图标、图片等资源优化
extension-assets