You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

styled-container-query

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

styled-container-query

Use Container Queries [Element Queries] with styled-components

1.3.5
latest
Source
npmnpm
Version published
Weekly downloads
1K
-33.94%
Maintainers
1
Weekly downloads
 
Created
Source

NPM-Version NPM-Downloads NPM-Size NPM-License

Styled Container Query

Use Container Queries [Element Queries] with styled-components

NPM-Package: styled-container-query

Demo

Installing

npm install styled-container-query --save

Usage

Nothing easier than that. You can use it like styled-components and an element query :container().

import styledContainerQuery from 'styled-container-query';

const Child = styled.span``
const Component = styledContainerQuery.div`
  background-color: green;
  
  &:container(min-width: 500px) {
    background-color: red;
    ${Child} {
          color: white;
      }
  }
  
  &:container(max-width: 600px and max-width: 900px) {
      background-color: yellow;
  }
  
  &:container(min-height: 500px) {
      background-color: blue;
  }
  
  &:container(min-width: 50%) {
      background-color: blue;
  }
`;

Known issues

  • Props inside a container-query does not work. #1

License

MIT License

Copyright © 2019 Freddy Ochner

LICENSE

Keywords

styled-components

FAQs

Package last updated on 07 Apr 2020

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