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

styled-tools

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

styled-tools

Utilities for styled-components


Version published
Weekly downloads
82K
decreased by-36.57%
Maintainers
1
Weekly downloads
 
Created

What is styled-tools?

The styled-tools npm package provides utility functions for use with styled-components, allowing for more dynamic and reusable styles in your React applications.

What are styled-tools's main functionalities?

theme

The `theme` function allows you to access theme properties defined in your styled-components theme object. This makes it easy to apply consistent styles across your application.

const Button = styled.button`
  color: ${theme('colors.primary')};
`;

ifProp

The `ifProp` function allows you to conditionally apply styles based on the presence of a prop. This is useful for creating dynamic styles that change based on component props.

const Button = styled.button`
  background: ${ifProp('primary', 'blue', 'gray')};
`;

prop

The `prop` function allows you to use component props to set CSS properties. This makes it easy to create highly customizable components.

const Box = styled.div`
  padding: ${prop('padding', '10px')};
`;

switchProp

The `switchProp` function allows you to switch between different styles based on the value of a prop. This is useful for creating components with multiple variants.

const Button = styled.button`
  background: ${switchProp('size', {
    small: '10px',
    medium: '20px',
    large: '30px'
  })};
`;

Other packages similar to styled-tools

Keywords

FAQs

Package last updated on 15 Oct 2018

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