Gathering detailed insights and metrics for reflexbox
Gathering detailed insights and metrics for reflexbox
Gathering detailed insights and metrics for reflexbox
Gathering detailed insights and metrics for reflexbox
npm install reflexbox
Typescript
Module System
Node Version
NPM Version
82.3
Supply Chain
49.5
Quality
72.8
Maintenance
100
Vulnerability
99.6
License
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7,935 Stars
2,024 Commits
646 Forks
59 Watchers
37 Branches
49 Contributors
Updated on Jul 12, 2025
Latest Version
4.0.6
Package Id
reflexbox@4.0.6
Size
4.58 kB
NPM Version
lerna/3.16.4/node@v10.16.3+x64 (darwin)
Node Version
10.16.3
Published on
Sep 21, 2019
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
5
1
1
???? Ergonomic, responsive React layout and grid system. The original Box component™ since 2015
sx
prop1npm i reflexbox
1import React from 'react' 2import { Flex, Box } from 'reflexbox' 3 4export default props => 5 <Flex flexWrap='wrap'> 6 <Box 7 width={[ 1, 1/2 ]} 8 p={3}> 9 Reflex 10 </Box> 11 <Box 12 width={[ 1, 1/2 ]} 13 p={3}> 14 Box 15 </Box> 16 </Flex>
sx
PropThe Box
and Flex
components both accept a sx
prop that works with no additional setup required.
The sx
prop is similar to Emotion's css
prop, but allows you to use values derived from the theme object.
Reflexbox follows the Theme Specification, which means that any theme created for use with Theme UI, Styled System, or other similar libraries will work out-of-the-box. This allows you to share design constraints for typography, color, and layout throughout your application using a theming context.
1<Box 2 sx={{ 3 p: 4, 4 color: 'primary', 5 }} 6/>
Note: to opt-out of theme-based styles, use the css
prop instead, which will not transform values.
Because Reflexbox follows the Theme Specification, all themes built for use with Styled System, Theme UI, or other related libraries are compatible with Reflexbox.
To add a theme to an application, import the ThemeProvider
component from emotion-theming
and pass a custom theme object in.
1npm i emotion-theming
1import React from 'react' 2import { ThemeProvider } from 'emotion-theming' 3import { Flex, Box } from 'reflexbox' 4 5const theme = { 6 breakpoints: [ 7 '40em', '52em', '64em', 8 ], 9 colors: { 10 text: '#000', 11 background: '#fff', 12 primary: '#07c', 13 }, 14 space: [ 15 0, 4, 8, 16, 32, 64, 128, 256, 16 ], 17} 18 19export default props => 20 <ThemeProvider theme={theme}> 21 <Box 22 sx={{ 23 p: 4, 24 bg: 'primary', 25 }}> 26 Hello 27 </Box> 28 </ThemeProvider>
For use with Theme UI, use gatsby-plugin-theme-ui
or import the Theme UI ThemeProvider
instead.
1import { ThemeProvider } from 'theme-ui'
Reflexbox components also accept a variant
prop, which allows you to define commonly used styles,
such as cards, badges, and CSS grid layouts, in your theme object for reuse.
Add a variants
object to your theme and include any variants as style objects. These styles can reference other values in your theme such as colors, typographic styles, and more.
1// example theme 2export default { 3 colors: { 4 text: '#000', 5 background: '#fff', 6 primary: '#07c', 7 }, 8 radii: { 9 default: 4, 10 }, 11 shadows: { 12 card: '0 0 4px rgba(0, 0, 0, .125)', 13 }, 14 variants: { 15 card: { 16 p: 3, 17 borderRadius: 'default', 18 bg: 'white', 19 boxShadow: 'card', 20 }, 21 badge: { 22 color: 'white', 23 bg: 'primary', 24 p: 1, 25 borderRadius: 'default', 26 }, 27 }, 28}
To apply a variant to your component, pass the name to the variant
prop.
1<Box variant='card'>Card</Box> 2<Box variant='badge'>Badge</Box>
Use array values to quickly and ergonomically add mobile-first responsive styles to specific properties.
This works on all style props and the sx
prop.
See the Styled System docs for more.
1// 100% width at the smallest viewport width 2// 50% width at the next breakpoint 3// 25% width at the next breakpoint 4<Box width={[ '100%', '50%', '25%' ]} />
You can customize the widths used for each breakpoint by defining a theme.breakpoints
array in your theme.
Reflexbox conforms to the Theme Specification and includes many common Styled System props.
The Box
and Flex
components accept the following props:
Prop | Theme Key |
---|---|
margin , m | space |
marginTop , mt | space |
marginRight , mr | space |
marginBottom , mb | space |
marginLeft , ml | space |
marginX , mx | space |
marginY , my | space |
padding , p | space |
paddingTop , pt | space |
paddingRight , pr | space |
paddingBottom , pb | space |
paddingLeft , pl | space |
paddingX , px | space |
paddingY , py | space |
Prop | Theme Key |
---|---|
width | sizes |
height | sizes |
minWidth | sizes |
maxWidth | sizes |
minHeight | sizes |
maxHeight | sizes |
Prop | Theme Key |
---|---|
fontFamily | fonts |
fontSize | fontSizes |
fontWeight | fontWeights |
lineHeight | lineHeights |
letterSpacing | letterSpacings |
fontStyle | N/A |
textAlign | N/A |
Prop | Theme Key |
---|---|
color | colors |
backgroundColor , bg | colors |
opacity | N/A |
Prop | Theme Key |
---|---|
alignItems | N/A |
alignContent | N/A |
justifyItems | N/A |
justifyContent | N/A |
flexWrap | N/A |
flexDirection | N/A |
flex | N/A |
flexGrow | N/A |
flexShrink | N/A |
flexBasis | N/A |
justifySelf | N/A |
alignSelf | N/A |
order | N/A |
To use Reflexbox with Styled Components, import components from reflexbox/styled-components
.
1import { Flex, Box } from 'reflexbox/styled-components'
This library is the result of consolidating APIs and ergonomics from the original Reflexbox library, Grid Styled, and Rebass Grid. Reflexbox originally appeared with the original version of Rebass in 2015.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/16 approved changesets -- score normalized to 0
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
150 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