ui-component-convention

ui-component-convention is a cursor rule for Cursor from thematters/matters-web. It costs 8 tokens per session (386 once invoked), scanned A, original, Apache-2.0.

Rules for creating and modifying UI components in a TypeScript project, including typed props, CSS Modules, theme variables, and consistent component structure.

In plain words
What is it for?
Use it when building or changing reusable interface components such as buttons, including their types, styles, variants, and usage documentation.
Why use it?
It keeps components predictable and consistent across sizes, colors, rendering options, states, and ref handling.

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/thematters/matters-web/ui-component-convention
Clone the repo
git clone --depth 1 https://github.com/thematters/matters-web

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 ui-component-convention

README.md
[![agentmods](https://agentmods.dev/badge/rules/thematters/matters-web/ui-component-convention.svg)](https://agentmods.dev/rules/thematters/matters-web/ui-component-convention)
Your own site
<a href="https://agentmods.dev/rules/thematters/matters-web/ui-component-convention"><img src="https://agentmods.dev/badge/rules/thematters/matters-web/ui-component-convention.svg" alt="Measured on agentmods" height="20"></a>
Per session 8 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 386 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.00008 $0.00386
Opus 5 $0.00004 $0.00193
Sonnet 5 $0.00002 $0.00077
Haiku 4.5 $0.00001 $0.00039

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

Security

Grade A, and why

ui-component-convention 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 3d 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.

.cursor/rules/ui-component-convention.mdc · 52 lines

What it actually says

UI Components Convention

Matters Web uses a standardized approach for UI components with consistent patterns for props, styling, and variations.

Here we use src/components/Button as an example:

Type Definitions

  • Props are strongly typed with explicit, restricted values
  • Component variations use union types (e.g., ButtonWidth, ButtonColor)
  • Core props are exported for reuse while internal types remain private
  • Uses TypeScript's Extract to define subsets of broader types

Styling Approach

  • Uses CSS Modules with classNames utility for conditional styling
  • Follows a pattern of {property}{Value} for class names (e.g., textGreen, borderRed)
  • Handles dynamic styles through prop-based conditions
  • Provides active/hover states via separate props (e.g., textActiveColor)
  • Uses CSS variables from the global theme

Component Structure

  • Accepts standardized size and spacing parameters
  • Supports multiple rendering options (button, link, anchor, span)
  • Implements forwardRef for ref forwarding
  • Provides comprehensive documentation with usage examples
  • Uses a consistent structure for container and content

Best Practices

  • Centralize shared prop types in the component file
  • Use descriptive prop names that indicate purpose
  • Document component behavior using JSDoc comments
  • Include usage examples for complex components
  • Handle accessibility considerations (focus states, keyboard navigation)
  • Ensure all interactive elements have appropriate event handlers

When Creating UI Components

  1. Start by defining clear prop interfaces with TypeScript
  2. Create a dedicated styles.module.css with the same structure as the component
  3. Follow naming conventions established in existing components
  4. Use classNames for conditional class application
  5. Include comprehensive JSDoc documentation
  6. Ensure consistent behavior across rendering contexts
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. 3d ago First seen · 52 lines · 8 tokens per session scan A 4468a66612f1

Subscribe to this mod's changes

ui-component-convention is a cursor rule published in the GitHub repository thematters/matters-web (86 stars, last pushed 1mo ago), licensed Apache-2.0. It adds 8 tokens to every session and 386 once invoked, about $0.0000 per session on Opus 5. 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-30.