Skip to main content

Grid

Grid component render a container that can resize automatically on the basis of provided props.

Example banner Example banner

Implementation code

import { Grid, StyledText } from '@nexara/nativeflow';

const Component = () => {
return (
<Grid container>
<Grid item justifyContent='center' alignItems='center' containerStyle={{ backgroundColor: 'green', height: 100}} xs={4} md={12} >
<StyledText>Item 1 xs={4}</StyledText>
</Grid>
<Grid item justifyContent='center' alignItems='center' containerStyle={{ backgroundColor: 'gray', height: 100 }} xs={4} md={6} >
<StyledText >Item 2 xs={4}</StyledText>
</Grid>
<Grid item justifyContent='center' alignItems='center' containerStyle={{ backgroundColor: 'blue', height: 100 }} xs={4} md={6}>
<StyledText >Item 3 xs={4}</StyledText>
</Grid>
<Grid item justifyContent='center' alignItems='center' containerStyle={{ backgroundColor: 'red', height: 100 }} xs={12} md={6} >
<StyledText >Item 4 xs={12}</StyledText>
</Grid>
</Grid>
);
}
export default Component;

Props

Props

Props

PropTypeDefaultDescription
containerbooleanfalseIf true, acts as a grid container. If item is false, this is set to true.
itembooleanfalseIf true, acts as a grid item. Should be used inside a container.
spacingnumber0Overall spacing (gap) between grid items.
spacingHnumber0Horizontal padding (left & right) of the container.
spacingVnumber0Vertical padding (top & bottom) of the container.
sizenumber12Total number of columns in the grid system.
xsnumber12Number of columns the item spans on extra-small (mobile) screens.
smnumber0Number of columns the item spans on small (tablet) screens.
mdnumber0Number of columns the item spans on medium (small laptops) screens.
lgnumber0Number of columns the item spans on large (desktops) screens.
xlnumber0Number of columns the item spans on extra-large (big monitors) screens.
containerStyleViewStyleAdditional styles for the grid container or item.

Grid screen sizes

sizevalue
xm0 and above
sm360 and above
md600 and above
lg768 and above
xl960 and above