react-chakra-ui---typescript-usage

react-chakra-ui---typescript-usage is a cursor rule for coding agents from holtwood/awesome-cursorrules-zh. It costs 0 tokens per session (403 once invoked), scanned A, original, MIT.

Guidance for using TypeScript with Chakra UI components in React. It covers typed component props, custom themes, editor support, and avoiding the unsafe any type.

In plain words
What is it for?
Use it when creating typed Chakra UI components, wrapping existing components, or adding custom theme settings to a React project.
Why use it?
It reduces mistakes when passing props or extending Chakra UI components and makes errors easier to find while coding. TypeScript can also provide code completion and safer refactoring.

Cursor rule

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/holtwood/awesome-cursorrules-zh/react-chakra-ui-typescript-usage
Clone the repo
git clone --depth 1 https://github.com/holtwood/awesome-cursorrules-zh

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-chakra-ui---typescript-usage

README.md
[![agentmods](https://agentmods.dev/badge/rules/holtwood/awesome-cursorrules-zh/react-chakra-ui-typescript-usage.svg)](https://agentmods.dev/rules/holtwood/awesome-cursorrules-zh/react-chakra-ui-typescript-usage)
Your own site
<a href="https://agentmods.dev/rules/holtwood/awesome-cursorrules-zh/react-chakra-ui-typescript-usage"><img src="https://agentmods.dev/badge/rules/holtwood/awesome-cursorrules-zh/react-chakra-ui-typescript-usage.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 403 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.00403
Opus 5 $0.00000 $0.00201
Sonnet 5 $0.00000 $0.00081
Haiku 4.5 $0.00000 $0.00040

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

Security

Grade A, and why

react-chakra-ui---typescript-usage 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 yesterday.

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.

docs/rules/frontend/react/chakra-ui/react-chakra-ui---typescript-usage.mdc · 32 lines

What it actually says

  • 对 Chakra UI 组件使用 TypeScript 确保类型安全
    • 类型推断:Chakra UI 组件通常具有良好的 TypeScript 类型定义,可以自动推断 props 的类型,减少手动定义的工作量。
    • 自定义组件的类型定义
      • 当创建自定义组件并包裹 Chakra UI 组件时,应正确定义组件的 props 接口,并利用 Chakra UI 提供的类型工具(如 ThemingPropsSystemProps)来确保类型安全和智能提示。
      • 示例:
        import { Box, BoxProps } from '@chakra-ui/react';
        import React from 'react';
        
        interface CustomCardProps extends BoxProps {
          title: string;
          description: string;
        }
        
        const CustomCard: React.FC<CustomCardProps> = ({ title, description, children, ...rest }) => {
          return (
            <Box p={5} shadow="md" borderWidth="1px" {...rest}>
              <Text fontSize="xl" fontWeight="semibold">{title}</Text>
              <Text mt={2}>{description}</Text>
              {children}
            </Box>
          );
        };
        
    • 主题类型:如果对 Chakra UI 主题进行了扩展,确保为自定义主题添加类型定义,以便在整个应用中获得类型安全。
    • 避免 any 类型:尽量避免使用 any 类型,尤其是在处理 Chakra UI 组件的 props 或样式时,以充分利用 TypeScript 的优势。
    • 工具支持:利用 VS Code 等 IDE 的 TypeScript 支持,获得代码补全、错误检查和重构等功能,提高开发效率。
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. yesterday First seen · 32 lines · 0 tokens per session scan A efa144335e05

Subscribe to this mod's changes

react-chakra-ui---typescript-usage is a cursor rule published in the GitHub repository holtwood/awesome-cursorrules-zh (232 stars, last pushed 29d ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 403 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-09-03.