All databases

Cursor rule

React Styled Components Cursorrules Prompt File

Cursor rules for React development with Styled Components integration.

Prefer functional components with hooks

js
const preferFunctionalComponents = true;

Styled Components best practices

js
const styledComponentsBestPractices = [
  "Use the styled-components/macro for better debugging",
  "Implement a global theme using ThemeProvider",
  "Create reusable styled components",
  "Use props for dynamic styling",
  "Utilize CSS helper functions like css`` when needed",
];

Folder structure

js
const folderStructure = `
src/
  components/
    styled/
  styles/
    theme.js
    globalStyles.js
  pages/
  utils/
`;

Additional instructions

js
const additionalInstructions = `
1. Use proper naming conventions for styled components (e.g., StyledButton)
2. Implement a consistent theming system
3. Use CSS-in-JS for all styling needs
4. Utilize styled-components' attrs method for frequently used props
5. Implement proper TypeScript support for styled-components
6. Use the css prop for conditional styling when appropriate
7. Follow the styled-components documentation for best practices
`;

More Frontend rules

Frequently asked questions

What is the React Styled Components Cursorrules Prompt File Cursor rule?

Cursor rules for React development with Styled Components integration. It is a Frontend rule, stored as react-styled-components-cursorrules-prompt-file.mdc.

How do I use the React Styled Components Cursorrules Prompt File rule in Cursor?

Copy the rule from this page and save it as react-styled-components-cursorrules-prompt-file.mdc in your project's .cursor/rules folder, or paste it into Cursor's project rules settings.