Skip to main content
rule CX Codex

dialog-trigger-pattern — Claude Code rule for dialogs

The dialog-trigger-pattern Claude Code rule defines how dialog components receive their trigger. It applies to .tsx files.

AGPL-3.0 ★ 1,120 updated 2026-11-16

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/dialog-trigger-pattern.mdc
Open on GitHub

What dialog-trigger-pattern does

The rule structures React dialogs so the component receives its trigger element through children and keeps its open state internally. A parent places the button or another trigger element inside the dialog component.

Do not pass open or onOpenChange from the parent. In Claude Code, place the rule file at .claude/rules/dialog-trigger-pattern.md; for Cursor, use .cursor/rules/dialog-trigger-pattern.mdc.

What it helps with

  • connect a button to a dialog with DialogTrigger
  • pass a trigger element into a dialog component through children
  • move dialog state ownership out of the parent component

Example prompts for the agent

  • Refactor this dialog so its button comes through children and uses DialogTrigger.
  • Check the .tsx files and remove parent-supplied open and onOpenChange props from dialog components.

How to install dialog-trigger-pattern

Manually: put the files in place

.cursor/rules/dialog-trigger-pattern.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about dialog-trigger-pattern

How do I install dialog-trigger-pattern in Claude Code?

Add the rule file at .claude/rules/dialog-trigger-pattern.md.

What does dialog-trigger-pattern do?

It sets a pattern for dialog components: the trigger comes through children, while the dialog owns its open state.

Which files does dialog-trigger-pattern apply to?

The rule targets .tsx files.

Similar IDE rules

All IDE rules for Frontend and UI →

From the same set25

The whole set →
server-actions This Claude Code rule guides the choice between Server Actions and API routes for reading or changing data. It applies when an agent writes server-side application logic. CX Codex +1 ★ 1,120repo stars input-label The input-label Claude Code rule sets how fields get their captions through the Input component. It applies to *.tsx files and disallows a separate caption above the field. CX Codex +1 ★ 1,120repo stars supabase-typed-mutations The supabase-typed-mutations Claude Code rule adds Database types to Supabase insert, update, and upsert calls. It applies while an agent works with these mutations. CX Codex +1 ★ 1,120repo stars use-shadcn This rule for Claude Code, Codex, and Cursor guides agents to reuse shadcn/ui components. When building UI, it directs them to look for existing project components first. CX Codex +1 ★ 1,120repo stars one-component-per-file The one-component-per-file Claude Code rule keeps each React component in its own file. It applies to *.tsx files. CX Codex +1 ★ 1,120repo stars realtime This Claude Code rule sets the pattern for Supabase Realtime subscriptions. It directs component code to useRealtimeSubscription instead of calling supabase.channel() directly. CX Codex +1 ★ 1,120repo stars ai-sdk This Claude Code rule covers structured data generation with the Vercel AI SDK. It applies to TypeScript and TSX files. CX Codex +1 ★ 1,120repo stars trigger.basic trigger.basic is a Claude Code rule for writing Trigger.dev tasks. It applies to TypeScript files matching **/trigger/**/*.ts. CX Codex +1 ★ 1,120repo stars

Project sponsors

Companies that keep this analytics open