superior-mq

css in js media query functions
3,920 1
Install
npm install superior-mq
Latest Version:1.0.1
License:MIT
Last Updated:Jan 4, 2023
Links: GitHub  ·  npm
Maintainer: jbsmith731

superior-mq

css-in-js media queries

screen.below Input:
@import screen from 'superior-mq'

screen.below('480px', `
  font-size: 1rem;
`)
screen.below Output:
@media screen and (max-width: 479px) {
  font-size: 12px;
}

screen.above Input:
@import screen from 'superior-mq'

screen.above('480px', `
  font-size: 1rem;
`)
screen.above Output:
@media screen and (min-width: 480px) {
  font-size: 12px;
}

screen.between Input:
@import screen from 'superior-mq'

screen.between('600px', '800px' `
  font-size: 1rem;
`)
screen.between Output:
@media screen and (min-width: 600px) and (max-width: 799px) {
  font-size: 1rem;
}

screen.belowHeight Input:
@import screen from 'superior-mq'

screen.belowHeight('480px', `
  font-size: 1rem;
`)
screen.belowHeight Output:
@media screen and (max-height: 479px) {
  font-size: 1rem;
}

screen.aboveHeight Input:
@import screen from 'superior-mq'

screen.aboveHeight('480px', `
  font-size: 1rem;
`)
screen.aboveHeight Output:
@media screen and (min-height: 480px) {
  font-size: 12px;
}

screen.betweenHeight Input:
@import screen from 'superior-mq'

screen.betweenHeight('600px', '800px' `
  font-size: 1rem;
`)
screen.betweenHeight Output:
@media screen and (min-height: 600px) and (max-height: 799px) {
  font-size: 1rem;
}

With styled-components

import styled from 'styled-components';
import screen from '@superior-media-query';

const PageHeading = styled.h1`
  font-size: 1.75rem;
  margin-bottom: .25rem;

  ${screenAbove('480px', `
    font-size: 2.5rem;
    margin-bottom: 1rem;
  `)}
`;

Related Packages

vue-responsive

A plugin for responsive design without media querys for Vue.js 2.x

25,134 97
tabpanelwidget

Responsive & versatile all-in-one solution tabpanel and accordion widget

2,490 105
postcss-px-convert

A PostCSS plugin and Node tool for converting px to rem or vw, suitable for CSS,...

3,564 1
app-location

A package to avoid repetition with Routes, Links and URLs, and reduce boilerplat...

34,498 19
server-side-render-resource

server side render resource dependence

22,685

Version History

Version Released License
1.0.1 MIT
1.0.0 MIT
0.1.3 MIT
0.1.2 MIT
0.1.1 MIT
Pre-releases (7)
Version Released License
1.0.0-beta-1 MIT
0.1.1-beta-2 MIT
0.1.1-beta-1 MIT
0.1.0-beta-3 MIT
0.1.0-beta-2 MIT