examples/styled-components-native/README.md
This example demonstrates using styled-components with Rolldown bundler, showcasing native CSS-in-JS styling capabilities.
css helpercss function:hover, :focus, :disabled, ::before supportThis example uses Rolldown's built-in OXC transform for styled-components, which provides:
The transform is configured in rolldown.config.js:
export default {
// ... snip
transform: {
plugins: {
styledComponents: {
displayName: true,
fileName: true,
ssr: true,
transpileTemplateLiterals: true,
minify: true,
pure: true,
namespace: 'rolldown-example',
},
},
},
};
# Install dependencies
pnpm install
# Build the project
pnpm build
Open index.html in your browser to see the styled components in action.
src/
├── index.jsx # React app entry point
├── App.jsx # Main app component with layout
└── components/
├── Button.jsx # Styled button component
└── Card.jsx # Styled card component
This example showcases how Rolldown efficiently bundles styled-components while preserving all CSS-in-JS functionality and runtime styling capabilities.