npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@sylphx/silk-react

v2.0.5

Published

React integration for Silk - Type-safe CSS-in-TypeScript with modern color functions and native nesting

Readme

@sylphx/silk-react

React bindings for Silk - type-safe styled components without codegen.

Installation

npm install @sylphx/silk @sylphx/silk-react
# or
bun add @sylphx/silk @sylphx/silk-react

Quick Start

import { defineConfig } from '@sylphx/silk'
import { createSilkReact } from '@sylphx/silk-react'

const config = defineConfig({
  colors: { brand: { 500: '#3b82f6' } },
  spacing: { 4: '1rem', 6: '1.5rem' }
})

const { styled, Box } = createSilkReact(config)

// Styled components with full type safety
const Button = styled('button', {
  bg: 'brand.500',
  px: 6,
  py: 4,
  _hover: { opacity: 0.8 }
})

// Or use Box with inline styles
function App() {
  return (
    <Box px={4} py={6}>
      <Button>Click me</Button>
    </Box>
  )
}

Features

  • Styled Components - styled() API like styled-components
  • Box Component - Flexible primitive with style props
  • Full Type Safety - Only design tokens allowed
  • Zero Runtime - Build-time CSS extraction with Babel plugin
  • React 18+ - Modern React support

Zero-Runtime Compilation

As of v2.0, Silk uses build-time transformation for true zero-runtime overhead:

Setup with Vite

// vite.config.ts
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import silk from '@sylphx/silk-vite-plugin'

export default defineConfig({
  plugins: [
    silk(), // Add BEFORE React plugin
    react(),
  ],
})

Direct css() Import Pattern

For zero-runtime, import css directly instead of using createStyleSystem():

// ✅ Zero-Runtime (recommended)
import { css } from '@sylphx/silk'

const button = css({
  bg: 'blue',
  color: 'white',
  px: 4,
  py: 2,
  _hover: { opacity: 0.8 }
})

function Button({ children }) {
  return <button className={button}>{children}</button>
}

How It Works

  1. Build Time: Babel plugin transforms css() calls into static class names

    // Your code
    const button = css({ bg: 'blue', p: 4 })
    
    // Transformed to
    const button = "silk_bg_blue_ey45 silk_p_4_dozm"
  2. CSS Extraction: CSS rules extracted to separate silk.css file

    .silk_bg_blue_ey45 { background-color: blue; }
    .silk_p_4_dozm { padding: 1rem; }
  3. Runtime: Zero CSS-in-JS overhead, just static class names

Performance Benefits

  • -6.5KB JS bundle (runtime code tree-shaken)
  • 1KB CSS file (atomic classes)
  • 389B Brotli (-61% compression)
  • 0ms runtime (no CSS generation at runtime)

Using with Styled Components

The styled() API works with zero-runtime automatically:

import { createSilkReact } from '@sylphx/silk-react'

const { styled } = createSilkReact(config)

// Styles are extracted at build-time
const Button = styled('button', {
  bg: 'brand.500',
  px: 6,
  py: 4,
  _hover: { opacity: 0.8 }
})

Note: Ensure your bundler is configured with @sylphx/silk-vite-plugin or equivalent.

Ecosystem

Core

Framework Integrations

Meta-Framework Plugins

Build Tools

Design System Presets

Documentation

Full documentation: GitHub Repository

License

MIT © SylphX Ltd