Cursor rule
Cursor Rules
Cursor rules for React component creation and development.
Whenever you need a React component
-
Carefully consider the component's purpose, functionality, and design
-
Think slowly, step by step, and outline your reasoning
-
Check if a similar component already exists in any of the following locations
- packages/ui/src/components
- apps/spa/src/components
-
If it doesn't exist, generate a detailed prompt for the component, including:
- Component name and purpose
- Desired props and their types
- Any specific styling or behavior requirements
- Mention of using Tailwind CSS for styling
- Request for TypeScript usage
-
URL encode the prompt.
-
Create a clickable link in this format: ComponentName
-
After generating, adapt the component to fit our project structure:
- Import
- common shadcn/ui components from <ui_package_alias>@repo/ui/components/ui/</ui_package_alias>
- app specific components from <app_package_alias>@/components</app_package_alias>
- Ensure it follows our existing component patterns
- Add any necessary custom logic or state management
- Import
Example prompt template: "Create a React component named {ComponentName} using TypeScript and Tailwind CSS. It should {description of functionality}. Props should include {list of props with types}. The component should {any specific styling or behavior notes}. Please provide the full component code."
Remember to replace placeholders like <ui_package_path> and <app_package_alias> with the actual values used in your project.
More Frontend rules
Frequently asked questions
What is the Cursor Rules Cursor rule?
Cursor rules for React component creation and development. It is a Frontend rule, stored as react-components-creation-cursorrules-prompt-file.mdc.
How do I use the Cursor Rules rule in Cursor?
Copy the rule from this page and save it as react-components-creation-cursorrules-prompt-file.mdc in your project's .cursor/rules folder, or paste it into Cursor's project rules settings.