# React Styled Components

> Cursor rules for React development with Styled Components integration.

| Field | Value |
| --- | --- |
| Content type | [Code](https://dopamine-prompt.com/en/type/code) |
| Models | [Cursor](https://dopamine-prompt.com/en/model/cursor) |
| Industries | [Software Development](https://dopamine-prompt.com/en/industry/software-dev) |
| Tags | [Cursor](https://dopamine-prompt.com/en/tag/cursor) |
| License | [CC0](https://creativecommons.org/publicdomain/zero/1.0/) |
| Source | Submitted by [jules\_rust](https://dopamine-prompt.com/en/u/4c24ae63-be03-46ac-a04b-61c43d42b85c) |
| Last updated | 2026-11-26 |

## Prompt

```
// React + Styled Components .cursorrules

// Prefer functional components with hooks

const preferFunctionalComponents = true;

// Styled Components best practices

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

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

// Additional instructions

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
`;
```

Web page: <https://dopamine-prompt.com/en/prompts/react-styled-components>
