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

substyle

Package Overview
Dependencies
Maintainers
1
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

substyle

Universal styling for reusable React components

  • 4.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
217K
decreased by-4.01%
Maintainers
1
Weekly downloads
 
Created

What is substyle?

The 'substyle' npm package is a utility for styling React components. It allows you to apply styles in a modular and reusable way, making it easier to manage and maintain your styles. 'substyle' provides a way to handle inline styles, CSS modules, and other styling approaches in a consistent manner.

What are substyle's main functionalities?

Inline Styles

This feature allows you to apply inline styles to your React components. The 'useStyles' function is used to create a style object, which can then be spread onto your component.

const { style } = useStyles({ color: 'red' });

const MyComponent = () => (
  <div {...style}>Hello World</div>
);

CSS Modules

This feature allows you to use CSS modules with your React components. The 'useStyles' function is used to create a style object from the imported CSS module, and you can apply specific classes using the style function.

import styles from './MyComponent.module.css';
const { style } = useStyles(styles);

const MyComponent = () => (
  <div {...style('myClass')}>Hello World</div>
);

Theming

This feature allows you to apply themes to your styles. You can define a theme object and use it to create styles that can be applied to your components.

const theme = { primaryColor: 'blue' };
const { style } = useStyles({ color: theme.primaryColor });

const MyComponent = () => (
  <div {...style}>Hello World</div>
);

Other packages similar to substyle

Keywords

FAQs

Package last updated on 01 Feb 2017

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