Gathering detailed insights and metrics for styled-bootstrap-grid
Gathering detailed insights and metrics for styled-bootstrap-grid
Gathering detailed insights and metrics for styled-bootstrap-grid
Gathering detailed insights and metrics for styled-bootstrap-grid
axelra-styled-bootstrap-grid
Re-implementation with styled-components of the bootstrap grid-layout system with some add-ons.
pl-styled-bootstrap-grid
bootstrap grid system using styled components
bear-react-grid
Most modern rwd grid system by react + styled-component
styled-bootstrap-grid-sc4
bootstrap grid system using styled components
Full Twitter Bootstrap v4 grid system implementation
npm install styled-bootstrap-grid
Typescript
Module System
Node Version
NPM Version
TypeScript (54.84%)
JavaScript (39.28%)
HTML (3.78%)
CSS (2.04%)
Shell (0.05%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
166 Stars
219 Commits
38 Forks
5 Watchers
31 Branches
11 Contributors
Updated on May 16, 2025
Latest Version
3.1.2
Package Id
styled-bootstrap-grid@3.1.2
Unpacked Size
70.45 kB
Size
13.22 kB
File Count
59
NPM Version
7.19.0
Node Version
14.17.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
17
This module is based on the styled-components module.
This module is highly inspired by the awesome work done on the react-bootstrap module.
This module is also based on the Twitter Bootstrap v4.1.3 bootstrap-grid.css
.
The css provided to styled bootstrap grid is not mine.
For more information about how does this grid system works (I mean with classes like containers, row, col, offset, push) , please refer to the official Twitter Bootstrap layout documentation.
npm i -S styled-bootstrap-grid
npm i -S react styled-components
Bootstrap is developed mobile first, a strategy in which we optimize code for mobile devices first and then scale up components as necessary using CSS media queries. To ensure proper rendering and touch zooming for all devices, add the responsive viewport meta tag to your
<head>
. from Bootstrap documentation
1<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
You also must inject the bootstrap base CSS in your application root file, like this.
1// app.js 2 3import { BaseCSS } from 'styled-bootstrap-grid'; 4 5export default (props) => 6 <Whatever> 7 <BaseCSS /> 8 </Whatever>; 9
You also can inject your own css like this :
1 2import { BaseCSS } from 'styled-bootstrap-grid'; 3 4const customCSS = ` 5 body { 6 color: red; 7 } 8`; 9 10export default (props) => 11 <Whatever> 12 <BaseCSS css={customCSS} /> 13 </Whatever>;
Basically, BaseCSS
takes a string prop, and append the default bootstrap layout base CSS with this string.
the default bootstrap layout CSS is :
1html { 2 -webkit-box-sizing: border-box; 3 box-sizing: border-box; 4 -ms-overflow-style: scrollbar; 5} 6 7*, 8*::before, 9*::after { 10 -webkit-box-sizing: inherit; 11 box-sizing: inherit; 12}
1import React from 'react'; 2import { Container, Row, Col } from 'styled-bootstrap-grid'; 3 4export default (props) => 5 <Whatever> 6 <Container> 7 <Row> 8 <Col col xl="1" lg="2" md="3" sm="6"> 9 Hello Bootstrap Layout 10 </Col> 11 </Row> 12 </Container> 13 <Container fluid> 14 <Row> 15 <Col col={6} sm={5} md={4} mdOffset={4}> 16 Hello Bootstrap Fluid Layout 17 </Col> 18 </Row> 19 </Container> 20 </Whatever>;
The package exposes a GridThemeProvider
that allows few custom theming properties. With this provider you can :
Container
padding left and right default valueRow
padding left and right default valueCol
padding left and right default valueThe GridThemeProvider
can be wrapped (or wrapped-in) the styled-component
's ThemeProvider
.
Example :
1import React from 'react'; 2import ReactDOM from 'react-dom'; 3import { GridThemeProvider } from 'styled-bootstrap-grid'; 4import { ThemeProvider } from 'styled-components'; 5 6import App from './whatever/app/folder'; 7 8const gridTheme = { 9 gridColumns: 24, // default 12 10 breakpoints: { // defaults below 11 xxl: 1440, 12 xl: 1200, 13 lg: 992, 14 md: 768, 15 sm: 576, 16 xs: 575, 17 // or you can use aliases 18 // veryGiant: 1440, 19 // giant: 1200, 20 // desktop: 992, 21 // tablet: 768, 22 // phone: 576, 23 // smaller: 575, 24 }, 25 row: { 26 padding: 10, // default 15 27 }, 28 col: { 29 padding: 5, // default 15 30 }, 31 container: { 32 padding: 0, // default 15 33 maxWidth: { // defaults below 34 xxl: 1141, 35 xl: 1140, 36 lg: 960, 37 md: 720, 38 sm: 540, 39 xs: 540, 40 // or you can use aliases 41 // veryGiant: 1141, 42 // giant: 1140, 43 // desktop: 960, 44 // tablet: 720, 45 // phone: 540, 46 // smaller: 540, 47 }, 48 }, 49}; 50const styledTheme = { 51 mainColor: 'purple', 52} 53 54ReactDOM.render( 55 <ThemeProvider 56 theme={styledTheme} 57 > 58 <GridThemeProvider 59 gridTheme={gridTheme} 60 > 61 <App /> 62 </GridThemeProvider> 63 </ThemeProvider>, 64 document.getElementById('root') 65); 66
This packages also exposes the media
element. It can be used in your styled-components like this :
1import styled from 'styled-components'; 2import { media } from 'styled-bootstrap-grid'; 3 4const CustomDiv = styled.div` 5 color: black; 6 ${media.smaller` 7 color: green; 8 `} 9 ${media.xs` 10 color: green; 11 `} 12 ${media.phone` 13 color: blue; 14 `} 15 ${media.sm` 16 color: blue; 17 `} 18 ${media.tablet` 19 color: red; 20 `} 21 ${media.md` 22 color: red; 23 `} 24 ${media.desktop` 25 color: purple; 26 `} 27 ${media.lg` 28 color: purple; 29 `} 30 ${media.giant` 31 color: yellow; 32 `} 33 ${media.xl` 34 color: yellow; 35 `} 36 ${media.veryGiant` 37 color: orange; 38 `} 39 ${media.xxl` 40 color: orange; 41 `} 42`; 43 44export default CustomDiv;
Using this media
object will help you to build media-queries that will fit the same way as Bootstrap do.
name | aliases | css generated |
---|---|---|
xs | smaller | all sizes: @media (max-width: 575px) { /* */ } |
sm | phone | @media (min-width: 576px) { /* */ } |
md | tablet | @media (min-width: 768px) { /* */ } |
lg | desktop | @media (min-width: 992px) { /* */ } |
xl | giant | @media (min-width: 1200px) { /* */ } |
xxl | veryGiant | @media (min-width: 1440px) { /* */ } |
props | default | type | description |
---|---|---|---|
gridTheme | undefined | Object | See description below(*) |
(*)
1 2const gridTheme = { 3 gridColumns: 12, // default 12 4 breakpoints: { // defaults below 5 xxl: 1440, 6 xl: 1200, 7 lg: 992, 8 md: 768, 9 sm: 576, 10 xs: 575, 11 // or you can use aliases 12 // veryGiant: 1440, 13 // giant: 1200, 14 // desktop: 992, 15 // tablet: 768, 16 // phone: 576, 17 // smaller: 575, 18 }, 19 row: { 20 padding: 10, // default 15 21 }, 22 col: { 23 padding: 5, // default 15 24 }, 25 container: { 26 padding: 0, // default 15 27 maxWidth: { // defaults below 28 xxl: 1141, 29 xl: 1140, 30 lg: 960, 31 md: 720, 32 sm: 540, 33 xs: 540, 34 // or you can use aliases 35 // veryGiant: 1141, 36 // giant: 1140, 37 // desktop: 960, 38 // tablet: 720, 39 // phone: 540, 40 // smaller: 540, 41 }, 42 }, 43} 44
props | default | type | description |
---|---|---|---|
fluid | false | boolean | Equivalent to container and container-fluid |
Plus the ones inherited from styled-components div
.
props | default | type | description |
---|---|---|---|
alignItems | undefined | string | start or end or center or baseline or stretch . Equivalent to align-items-{value} |
smAlignItems | undefined | string | start or end or center or baseline or stretch . Equivalent to align-items-sm-{value} |
mdAlignItems | undefined | string | start or end or center or baseline or stretch . Equivalent to align-items-md-{value} |
lgAlignItems | undefined | string | start or end or center or baseline or stretch . Equivalent to align-items-lg-{value} |
xlAlignItems | undefined | string | start or end or center or baseline or stretch . Equivalent to align-items-xl-{value} |
justifyContent | undefined | string | start or end or center or between or around . Equivalent to justify-content-{value} |
smJustifyContent | undefined | string | start or end or center or between or around . Equivalent to justify-content-sm-{value} |
mdJustifyContent | undefined | string | start or end or center or between or around . Equivalent to justify-content-md-{value} |
lgJustifyContent | undefined | string | start or end or center or between or around . Equivalent to justify-content-lg-{value} |
xlJustifyContent | undefined | string | start or end or center or between or around . Equivalent to justify-content-xl-{value} |
Plus the ones inherited from styled-components div
.
props | default | type | description |
---|---|---|---|
col | undefined | number or string or boolean | Goes from 1 to 12. Equivalent to col-* (or col in case of true ) |
offset | undefined | number or string | Goes from 0 to 11. Equivalent to offset-* |
auto | undefined | boolean | Equivalent to col-auto |
alignSelf | undefined | string | auto or start or end or center or baseline or stretch . Equivalent to align-self-{value} |
order | undefined | number or string | first or last or 0 to 12 . Equivalent to order-{value} |
noGutter | undefined | boolean | Equivalent to no-gutter |
sm | undefined | number or string | Goes from 1 to 12. Equivalent to col-sm-* (or col-sm in case of true ) |
hiddenXsUp | undefined | boolean | Hides content from xs breakpoint to infinity |
hiddenXsDown | undefined | boolean | Hides content from xs breakpoint to 0 |
smOffset | undefined | number or string | Goes from 0 to 11. Equivalent to offset-sm-* |
smAuto | undefined | boolean | Equivalent to col-sm-auto |
smAlignSelf | undefined | string | auto or start or end or center or baseline or stretch . Equivalent to align-self-sm-{value} |
smOrder | undefined | number or string | first or last or 0 to 12 . Equivalent to order-sm-{value} |
hiddenSmUp | undefined | boolean | Hides content from sm breakpoint to infinity |
hiddenSmDown | undefined | boolean | Hides content from sm breakpoint to 0 |
md | undefined | number or string | Goes from 1 to 12. Equivalent to col-md-* (or col-md in case of true ) |
mdOffset | undefined | number or string | Goes from 0 to 11. Equivalent to offset-md-* |
mdAuto | undefined | boolean | Equivalent to col-md-auto |
mdAlignSelf | undefined | string | auto or start or end or center or baseline or stretch . Equivalent to align-self-md-{value} |
mdOrder | undefined | number or string | first or last or 0 to 12 . Equivalent to order-md-{value} |
hiddenMdUp | undefined | boolean | Hides content from md breakpoint to infinity |
hiddenMdDown | undefined | boolean | Hides content from md breakpoint to 0 |
lg | undefined | number or string | Goes from 1 to 12. Equivalent to col-lg-* (or col-lg in case of true ) |
lgOffset | undefined | number or string | Goes from 0 to 11. Equivalent to offset-lg-* |
lgAuto | undefined | boolean | Equivalent to col-lg-auto |
lgAlignSelf | undefined | string | auto or start or end or center or baseline or stretch . Equivalent to align-self-lg-{value} |
lgOrder | undefined | number or string | first or last or 0 to 12 . Equivalent to order-lg-{value} |
hiddenLgUp | undefined | boolean | Hides content from lg breakpoint to infinity |
hiddenLgDown | undefined | boolean | Hides content from lg breakpoint to 0 |
xl | undefined | number or string | Goes from 1 to 12. Equivalent to col-xl-* (or col-xl in case of true ) |
xlOffset | undefined | number or string | Goes from 0 to 11. Equivalent to offset-xl-* |
xlAuto | undefined | boolean | Equivalent to col-xl-auto |
xlAlignSelf | undefined | string | auto or start or end or center or baseline or stretch . Equivalent to align-self-xl-{value} |
xlOrder | undefined | number or string | first or last or 0 to 12 . Equivalent to order-xl-{value} |
hiddenXlUp | undefined | boolean | Hides content from xl breakpoint to infinity |
hiddenXlDown | undefined | boolean | Hides content from xl breakpoint to 0 |
Plus the ones inherited from styled-components div
.
To run the example
example
's directory with cd <styled-bootstrap-grid folder path>/example
example
's dependencies with yarn
yarn start
Any other idea ? Please leave a suggestion.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/20 approved changesets -- score normalized to 3
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
105 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More