一键导入
popup-patterns
Popup component conventions for DropdownMenu, Select, Combobox, and Popover. Apply when creating or editing popup/overlay components in packages/ui/.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Popup component conventions for DropdownMenu, Select, Combobox, and Popover. Apply when creating or editing popup/overlay components in packages/ui/.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | popup-patterns |
| description | Popup component conventions for DropdownMenu, Select, Combobox, and Popover. Apply when creating or editing popup/overlay components in packages/ui/. |
| globs | packages/ui/src/dropdown-menu.tsx,packages/ui/src/select.tsx,packages/ui/src/combobox.tsx,packages/ui/src/popover.tsx |
| alwaysApply | false |
Consolidated conventions for the four popup components: DropdownMenu, Select, Combobox, and Popover. These components share container styling, item sizing, and animations.
All popup item components use the shared POPUP_ITEM_HEIGHT constant from packages/ui/src/utils.ts:
export const POPUP_ITEM_HEIGHT = "h-9 [[data-size=compact]_&]:h-8";
| Size | Class | Pixels | Use case |
|---|---|---|---|
| default | h-9 | 36px | Standard menus and dropdowns — comfortable touch targets, good for most interfaces |
| compact | h-8 | 32px | Dense lists with many items — reduces vertical space while staying accessible |
The content component (DropdownMenuContent, SelectContent, ComboboxContent) accepts a size prop:
size?: "default" | "compact";
This sets data-size="compact" on the content container. The POPUP_ITEM_HEIGHT class uses Tailwind's descendant selector [[data-size=compact]_&]:h-8 to detect the parent attribute and override h-9 to h-8 on all items inside.
// Default — 36px items
<DropdownMenuContent>
<DropdownMenuItem>Profile</DropdownMenuItem>
<DropdownMenuItem>Settings</DropdownMenuItem>
</DropdownMenuContent>
// Compact — 32px items
<DropdownMenuContent size="compact">
<DropdownMenuItem>Profile</DropdownMenuItem>
<DropdownMenuItem>Settings</DropdownMenuItem>
</DropdownMenuContent>
// Same pattern for Select and Combobox
<SelectContent size="compact">...</SelectContent>
<ComboboxContent size="compact">...</ComboboxContent>
POPUP_ITEM_HEIGHT — never hardcode h-9 or h-8 on popup items directly./utils: import { cn, POPUP_ITEM_HEIGHT } from "./utils";POPUP_ITEM_HEIGHT| Component | Items that consume the height |
|---|---|
| DropdownMenu | DropdownMenuItem, DropdownMenuSubTrigger, DropdownMenuCheckboxItem, DropdownMenuRadioItem |
| Select | SelectItem |
| Combobox | ComboboxItem |
All popup containers share this composite recipe:
bg-popover text-popover-foreground ring-popup-ring ring-1 rounded-lg shadow-lg z-50 overflow-hidden
| Property | Value | Notes |
|---|---|---|
| Background | bg-popover | Semantic token — adapts to light/dark |
| Text | text-popover-foreground | Set on popup root |
| Ring | ring-popup-ring ring-1 | Subtle border via custom token |
| Radius | rounded-lg | 8px for main popups |
| Shadow | shadow-lg | Elevated appearance |
| Z-index | z-50 | Above page content |
| Overflow | overflow-hidden | Clips content to rounded corners |
DropdownMenuSubContent): rounded-md and min-w-24 instead of rounded-lg and min-w-32overflow-auto instead of overflow-hidden (popover content can be arbitrarily long)Always apply these classes together. Do NOT mix shadow or ring values across popup types.
All four popup components share identical enter/exit animations:
data-open:animate-in data-closed:animate-out
data-closed:fade-out-0 data-open:fade-in-0
data-closed:zoom-out-95 data-open:zoom-in-95
data-[side=bottom]:slide-in-from-top-2
data-[side=left]:slide-in-from-right-2
data-[side=right]:slide-in-from-left-2
data-[side=top]:slide-in-from-bottom-2
data-[side=inline-start]:slide-in-from-right-2
data-[side=inline-end]:slide-in-from-left-2
duration-100
Copy this block exactly. Do not modify individual animation values across popup types — they must stay in sync.
Popup separators use bg-border-muted (subtle, lower contrast), NOT bg-border (which is for standalone Separator components):
<DropdownMenuSeparator className="-mx-1 my-1 h-px bg-border-muted" />
If you ever need to add a new popup-based component:
POPUP_ITEM_HEIGHT from ./utils for item sizingsize?: "default" | "compact" on the content componentdata-size={size} on the content containerbg-border-muted for separators inside the popupring-popup-ring for the container ring — not ring-border/10Component workflow for keystoneui — triggered when adding, creating, scaffolding, or modifying components, demos, stories, MDX docs, or any AI-agent surface (SKILL.md, AGENTS.md, llms.txt, MCP registry).
Manages Keystone UI components and projects — adding, searching, fixing, debugging, styling, and composing UI built on Tailwind CSS v4 + Base UI. Provides project context, component docs, and usage examples. Applies when working with Keystone UI, @keystoneui/react, components.json with @keystoneui/* registries, or any project with @keystoneui/react in its dependencies. Also triggers for "keystoneui add", "find a Keystone UI example", or "switch to Keystone UI".
Component architecture conventions for the @keystoneui/react package. Apply when creating, editing, or reviewing UI components in packages/ui/.
Design token conventions for the @keystoneui/react component library. Apply when creating or editing UI components in packages/ui/.
Use this agent to run a systematic audit of the Keystone UI codebase against all project skills and rules. This covers component architecture, design tokens, documentation quality, React performance, and animation patterns. Use before releases, after large refactors, or periodically to catch drift. Triggers on keywords like audit codebase, check compliance, review practices, pre-release check, quality audit, scan for violations, check conventions.
Use this agent to review, improve, or curate documentation files for Keystone UI. This includes Storybook stories in /apps/storybook/stories/ and (future) MDX documentation. The agent verifies accuracy against component source, ensures completeness of variant/state coverage, improves code examples, and maintains consistency with Keystone UI patterns. Triggers on keywords like review stories, improve documentation, curate docs, audit stories, check documentation quality, story review, docs review.