Socket
Book a DemoInstallSign in
Socket

@slice-and-dice/govuk-react-grid-col

Package Overview
Dependencies
Maintainers
8
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@slice-and-dice/govuk-react-grid-col

GridCol component for use inside GridRow component - includes media query breakpoints.

latest
npmnpm
Version
0.7.1
Version published
Maintainers
8
Created
Source

GridCol

Import

  import GridCol from '@govuk-react/grid-col';

Should always be wrapped by GridRow. Will always render a column at full width if the browser width is below the TABLET breakpoint.

NB our grid is based on flex-box, which differs from govuk-frontend, which instead uses floats, however it is otherwise similar to use.

Usage

Simple

import GridRow from '@govuk-react/grid-row';
import GridCol from '@govuk-react/grid-col';

<Fragment>
  <GridRow>
    <GridCol>
      ...
    </GridCol>
  </GridRow>
  <GridRow>
    <GridCol setWidth="one-half">
      ...
    </GridCol>
    <GridCol setWidth="one-quarter">
      ...
    </GridCol>
    <GridCol setWidth="one-quarter">
      ...
    </GridCol>
  <GridRow>
    <GridCol setWidth="one-third">
      ...
    </GridCol>
    <GridCol setWidth="two-thirds">
      ...
    </GridCol>
  </GridRow>
  <GridRow>
    <GridCol setWidth="one-third" setDesktopWidth="one-quarter">
      ...
    </GridCol>
    <GridCol setWidth="two-thirds" setDesktopWidth="auto">
      ...
    </GridCol>
  </GridRow>
</Fragment>

References:

  • https://github.com/alphagov/govuk_frontend_toolkit/blob/master/stylesheets/_grid_layout.scss
  • https://github.com/alphagov/govuk_elements/blob/master/assets/sass/elements/_layout.scss

Properties

PropRequiredDefaultTypeDescription
childrenundefinednodeGridCol content
columnFullfalseboolDimension setting for the column (deprecated)
columnOneHalffalseboolDimension setting for the column (deprecated)
columnOneQuarterfalseboolDimension setting for the column (deprecated)
columnOneThirdfalseboolDimension setting for the column (deprecated)
columnThreeQuartersfalseboolDimension setting for the column (deprecated)
columnTwoThirdsfalseboolDimension setting for the column (deprecated)
setDesktopWidthundefinedunion(string | number | enum)Explicitly set desktop column to width using value or descriptive string
(one-quarter, one-third, one-half, two-thirds, three-quarters, full)
setWidthundefinedunion(string | number | enum)Explicitly set column to width using value or descriptive string
(one-quarter, one-third, one-half, two-thirds, three-quarters, full)

FAQs

Package last updated on 10 Mar 2021

Did you know?

Socket

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.

Install

Related posts