react-components

react-components is a cursor rule for Cursor from vanessamarely/ai-playbook-reposito. It costs 0 tokens per session (1,112 once invoked), scanned A, original, MIT.

A set of rules for building React user-interface components with TypeScript, Tailwind CSS, and shadcn/ui. It also requires keyboard support, meaningful HTML elements, and WCAG 2.2 Level AA accessibility practices.

In plain words
What is it for?
Use it when creating or changing React components, including their properties, events, keyboard behavior, semantic HTML, and accessibility details.
Why use it?
It gives component work consistent type checks and accessibility expectations, reducing common problems for keyboard users and people using assistive technology.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/vanessamarely/ai-playbook-reposito/react-components
Clone the repo
git clone --depth 1 https://github.com/vanessamarely/ai-playbook-reposito

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for react-components

README.md
[![agentmods](https://agentmods.dev/badge/rules/vanessamarely/ai-playbook-reposito/react-components.svg)](https://agentmods.dev/rules/vanessamarely/ai-playbook-reposito/react-components)
Your own site
<a href="https://agentmods.dev/rules/vanessamarely/ai-playbook-reposito/react-components"><img src="https://agentmods.dev/badge/rules/vanessamarely/ai-playbook-reposito/react-components.svg" alt="Measured on agentmods" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 1,112 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.01112
Opus 5 $0.00000 $0.00556
Sonnet 5 $0.00000 $0.00222
Haiku 4.5 $0.00000 $0.00111

Measured 4d ago against content hash dd075b187741, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

react-components scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

ai-playbook/.cursor/rules/react-components.mdc · 72 lines

How it starts

The opening of the file, as written. The whole thing — 72 lines — stays where its author put it; the contents beside it link to each section on GitHub.

React Components

Create or modify React components using TypeScript with strict accessibility compliance (WCAG 2.2 Level AA), semantic HTML, and type safety. Not for Node.js services, API endpoints, database schemas, or non-React frameworks (Vue, Svelte, Angular).

For a guided end-to-end build (component + tests + summary), use /react-component-builder.

Procedure

  1. Validate the component name — PascalCase, check for conflicts with existing components in the target directory.
  2. Define the TypeScript interface for props — required props without ?, optional with ?, specific types (avoid any), typed event handlers (e.g., onClick?: (event: React.MouseEvent) => void).
  3. Choose semantic HTML: <button> for actions, <a> for navigation, <input>/<select>/<textarea> for form fields, <nav>/<header>/<main>/<footer> for landmarks, <article>/<section> for content structure. Avoid <div>/<span> for interactive elements.
  4. Implement keyboard support for interactive components — onKeyDown for Enter/Space, arrow-key navigation for lists/menus, focus trap + restore for modals, ensure Tab reachability:
    const handleKeyDown = (event: React.KeyboardEvent) => {
      if (event.key === 'Enter' || event.key === ' ') {
        event.preventDefault()
        handleAction()
      }
    }
    
  5. Add ARIA only when semantic HTML is insufficient: aria-label for icon buttons without visible text, aria-labelledby to reference visible labels, aria-describedby for extra context, aria-expanded for toggles/dropdowns, aria-live for dynamic updates.
  6. Implement focus management for modals: move focus in on open, trap focus while open, restore focus to the trigger element on close.
    const modalRef = useRef<HTMLDivElement>(null)
    useEffect(() => {
      if (isOpen && modalRef.current) modalRef.current.focus()
    }, [isOpen])
    
  7. Follow project-specific conventions already present in the codebase.
  8. Generate the component file: imports, TypeScript interface, component function with typed props, JSX with semantic elements and accessibility attributes, export.
  9. Validate accessibility: semantic HTML used correctly, keyboard handlers present, ARIA valid and necessary, focus management for modals, contrast meets 4.5:1 (normal text) / 3:1 (large text).
  10. Suggest testing: unit tests for logic, accessibility tests with @axe-core/react or jest-axe, manual keyboard navigation testing. Commands: npm run lint (if eslint-plugin-jsx-a11y configured), npm test -- <ComponentName>.

Read the full file on GitHub · 72 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 72 lines · 0 tokens per session scan A dd075b187741

Subscribe to this mod's changes

react-components is a cursor rule published in the GitHub repository vanessamarely/ai-playbook-reposito (2 stars, last pushed 1mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,112 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.