Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stitches/react

Package Overview
Dependencies
Maintainers
3
Versions
92
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stitches/react

The modern CSS-in-JS library

  • 1.2.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
219K
decreased by-0.37%
Maintainers
3
Weekly downloads
 
Created

What is @stitches/react?

@stitches/react is a CSS-in-JS library for React that allows developers to write CSS with JavaScript. It provides a powerful and flexible API for styling components, theming, and responsive design.

What are @stitches/react's main functionalities?

Styling Components

This feature allows you to create styled components using the `styled` function. You can define styles directly in your JavaScript code and apply them to your React components.

const { styled } = require('@stitches/react');

const Button = styled('button', {
  backgroundColor: 'blue',
  color: 'white',
  padding: '10px 20px',
  borderRadius: '5px',
  '&:hover': {
    backgroundColor: 'darkblue'
  }
});

// Usage in a React component
// <Button>Click me</Button>

Theming

Theming allows you to define a set of design tokens (e.g., colors, fonts) that can be used throughout your application. This makes it easy to maintain a consistent design and update styles globally.

const { createStitches } = require('@stitches/react');

const { styled, theme } = createStitches({
  theme: {
    colors: {
      primary: 'blue',
      secondary: 'green'
    }
  }
});

const Button = styled('button', {
  backgroundColor: '$primary',
  color: 'white',
  padding: '10px 20px',
  borderRadius: '5px'
});

// Usage in a React component
// <Button>Click me</Button>

Responsive Design

This feature allows you to define responsive styles using media queries. You can specify different styles for different screen sizes, making it easy to create responsive designs.

const { styled } = require('@stitches/react');

const Box = styled('div', {
  width: '100%',
  padding: '20px',
  backgroundColor: 'lightgray',
  '@media (min-width: 600px)': {
    backgroundColor: 'gray'
  },
  '@media (min-width: 900px)': {
    backgroundColor: 'darkgray'
  }
});

// Usage in a React component
// <Box>Responsive Box</Box>

Other packages similar to @stitches/react

Keywords

FAQs

Package last updated on 25 Apr 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc