# composition

Enforces component composition patterns: wraps list items in groups, requires modal titles for accessibility, and swaps custom divs for UI primitives.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 7523 repo stars
- Author: Devin-AXIS
- License: LicenseRef-Proprietary · policy=link-only · description only; the file stays with the author
- Source: https://github.com/Devin-AXIS/iPolloWork/tree/HEAD/.opencode/skills/shadcn/rules/composition.md
- Updated: 2026-10-29
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/composition

## What it does

The rule guides coding agents through strict UI composition patterns. Dropdown and menu elements such as `SelectItem` or `CommandItem` must live inside their corresponding group wrappers like `SelectGroup` or `CommandGroup`. Similarly, `TabsTrigger` requires a `TabsList` parent, and `Avatar` must include an `AvatarFallback` element.

It explicitly stops the agent from guessing non-existent `isLoading` or `isPending` flags on buttons. Loading indicators must use a nested `Spinner` paired with the standard `disabled` attribute. Overlay components like `Dialog`, `Sheet`, and `Drawer` strictly require a title element, relying on `sr-only` classes when hidden visually.

Without a Radix-style UI library and `sonner` present in the project, the generated imports and markup will break your build.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/rules/composition.md` — The paths frontmatter field limits the files

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### Cursor

**Manually: put the files in place**
- File: `.cursor/rules/composition.mdc` — Frontmatter: description, globs, alwaysApply

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/composition.instructions.md` — The applyTo field sets which files it applies to

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/composition.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/composition.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Devin-AXIS/iPolloWork/tree/HEAD/.opencode/skills/shadcn/rules/composition.md

## When to use it
- stop agents from adding imaginary loading props to buttons
- enforce accessible title elements on dialogs and sheets
- nest dropdown and select items inside proper group parents
- replace raw divider lines and custom badges with design system primitives

## Example prompts
- Build an account settings modal using the `Dialog` component
- Create a team member overview card with header and footer actions
- Set up a project category filter using `Select`

## Similar
- [animated-component-libraries](https://affpapa.org/en/nevibecode/skills/animated-component-libraries.md) — skill · 3200 installs
- [json-render-shadcn](https://affpapa.org/en/nevibecode/skills/json-render-shadcn.md) — skill · 257 installs
- [ask-sonner](https://affpapa.org/en/nevibecode/skills/ask-sonner.md) — skill · 191600 installs
- [islandcn](https://affpapa.org/en/nevibecode/skills/islandcn.md) — skill · ★ 836 repo stars
- [ui-styling](https://affpapa.org/en/nevibecode/skills/ui-styling.md) — skill · 52100 installs
- [shadcn-ui](https://affpapa.org/en/nevibecode/skills/giuseppe-trisciuoglio-shadcn-ui.md) — skill · 22800 installs

## Other versions with the same name
- [composition · maxtrigify](https://affpapa.org/en/nevibecode/rules/maxtrigify-composition.md) — ★ 141 repo stars

From the same set: [devin-axis/ipollowork](https://affpapa.org/en/nevibecode/by/devin-axis/ipollowork.md) — 42 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
