
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
responsive-style-kit
Advanced tools
A React utility for responsive scaling of styled-components with viewport-based size hooks.
A TypeScript-based utility toolkit for responsive React apps. It provides viewport-based scaling utilities to make your UI automatically adapt to different screen sizes without media queries. Works with both styled-components and vanilla React.
useResponsive and useResponsiveDimension hooksas propnpm install responsive-style-kit
For styled-components integration, you'll need to install
styled-components@6separately.
The package uses a base design resolution (360×722 by default) and scales your values based on the current viewport dimensions. It provides both a React context for global scaling and utility functions for direct usage. All components and hooks automatically handle window resizing with debouncing for optimal performance.
The scaling is direction-aware:
import { ResponsiveThemeProvider } from 'responsive-style-kit';
const App = () => {
return (
<ResponsiveThemeProvider>
<YourApp />
</ResponsiveThemeProvider>
);
};
import { useResponsiveDimension, DIMENSION_TYPE } from 'responsive-style-kit';
const MyComponent = () => {
const width = useResponsiveDimension(DIMENSION_TYPE.HORIZONTAL, 200);
const height = useResponsiveDimension(DIMENSION_TYPE.VERTICAL, 100);
const fontSize = useResponsiveDimension(DIMENSION_TYPE.HORIZONTAL, 16);
return (
<div
style={{
width,
height,
fontSize
}}
>
Responsive Content
</div>
);
};
import { responsiveElement } from 'responsive-style-kit';
import styled from 'styled-components';
// Basic usage
const Container = styled(responsiveElement)`
background: #f0f0f0;
`;
// With custom element type and directional spacing
const Card = styled(responsiveElement).attrs({ as: 'article' })`
background: white;
border-radius: 8px;
`;
const MyComponent = () => {
return (
<>
<Container
width={200}
height={100}
marginLeft={20}
marginRight={20}
marginTop={16}
marginBottom={16}
>
Responsive Box
</Container>
<Card
width={300}
height={200}
paddingLeft={24}
paddingRight={24}
paddingTop={32}
paddingBottom={32}
fontSize={14}
>
Card Content
</Card>
</>
);
};
import { useResponsive } from 'responsive-style-kit';
const MyComponent = () => {
const { baseViewport, currentViewport, scaleWidth, scaleHeight } = useResponsive();
return (
<div style={{
width: 200 * scaleWidth,
height: 100 * scaleHeight,
marginTop: 16 * scaleHeight,
marginLeft: 20 * scaleWidth
}}>
Responsive Content
</div>
);
};
import { ResponsiveThemeProvider } from 'responsive-style-kit';
const customViewport = {
width: 375, // iPhone X width
height: 812 // iPhone X height
};
const App = () => (
<ResponsiveThemeProvider baseViewport={customViewport}>
<YourApp />
</ResponsiveThemeProvider>
);
The package integrates with styled-components theming system. You can specify whether to scale based on width or height:
const theme = {
scale: "width" // or "height"
};
const App = () => (
<ThemeProvider theme={theme}>
<ResponsiveThemeProvider>
<YourApp />
</ResponsiveThemeProvider>
</ThemeProvider>
);
The default base design dimensions are:
These values can be customized through the ResponsiveThemeProvider props.
Feel free to submit issues or open pull requests for improvements, examples, or docs.
MIT License © 2025 himrd95
FAQs
A React utility for responsive scaling of styled-components with viewport-based size hooks.
We found that responsive-style-kit demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.