Zero Runtime Overhead
CSS extracted at build time. Zero JavaScript in the browser for styles.
Type-safe, zero-runtime CSS with build-time extraction. 45-65% smaller CSS in production.
npm install @sylphx/silk @sylphx/silk-nextjsbun add @sylphx/silk @sylphx/silk-nextjsimport { css } from '@sylphx/silk'
const button = css({
background: 'linear-gradient(135deg, #667eea, #764ba2)',
padding: '12px 24px',
borderRadius: '8px',
color: 'white',
fontWeight: 600,
_hover: {
transform: 'translateY(-2px)',
boxShadow: '0 10px 20px rgba(0,0,0,0.2)'
}
})
export function Button() {
return <button className={button}>Click me</button>
}Unlike traditional CSS-in-JS solutions, Silk extracts all CSS at build time. Your users download zero JavaScript for styling.
Atomic CSS with automatic deduplication means 45-65% smaller CSS output compared to traditional approaches.
No runtime style injection. No CSSOM manipulation. Just static CSS that loads instantly.
Full TypeScript support with IntelliSense for all CSS properties. Catch errors at compile time, not runtime.
Full support for Turbopack and Webpack modes. Automatic configuration, zero-runtime overhead.
Silk works seamlessly with all major frameworks:
| Framework | Traditional CSS-in-JS | Silk |
|---|---|---|
| Runtime JS | 15-30KB | 0KB ✅ |
| Style injection | Runtime | Build-time ✅ |
| CSS size | 100% | 45-65% ✅ |
| Hydration | Required | None ✅ |
Silk generates modern CSS that works in all evergreen browsers:
For older browsers, Silk includes automatic fallbacks and polyfills.
// Your code (input)
const button = css({ color: 'red', padding: '1rem' })
// After build (output)
const button = 'silk-a7f3 silk-b2e1'
// Generated CSS
.silk-a7f3 { color: red; }
.silk-b2e1 { padding: 1rem; }// Multiple components
const button1 = css({ color: 'red', padding: '1rem' })
const button2 = css({ color: 'red', margin: '2rem' })
// Only generates 3 classes (not 4!)
.silk-a7f3 { color: red; } // Shared!
.silk-b2e1 { padding: 1rem; }
.silk-c3d4 { margin: 2rem; }const styles = css({
display: 'flex', // ✅ Valid
backgroundColor: '#000', // ✅ Valid
paddingg: '1rem', // ❌ TypeScript error
color: 123 // ❌ TypeScript error
})Jump straight into the Getting Started guide or explore Next.js integration for framework-specific setup.