Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@acrool/react-grid

acrool1.2kMIT6.1.0TypeScript support: included

Most modern rwd grid system by react + styled-component

react, typescript, flexbox, styled-component, Bootstrap, grid-system

readme

Acrool React Grid

Acrool React Grid Logo

CSS IN JS following Bootstrap RWD design, composed of React + Styled Component

NPM npm npm

npm downloads npm

Version Styled-component React
6.x 6.x ^18.3
5.x 5.x 18.0 ~ 18.3

Documentation

Features

  • Use React + Styled-component and styled-component themeProvider
  • Easier to use
  • Refer to the design of Bootstrap 5 and change it to CSS IN JS method
  • Provides tool CSS for Bootstrap 5 layout
  • Provide RWD Media query method
  • Support NextJS 14 (v5.0.3+)
  • Container max width --container-max-width-? Change from the middle level

Installation

yarn add styled-components @acrool/react-grid

in your packages. (Make the version of styled-component you use match the version of styled-component used in acrool-react-gird)

{
    "resolutions": {
        "styled-components": "6.1.17"
    }
}

in your App.js add
see the example/src/App.js

import {GridThemeProvider, IGridSetting} from '@acrool/react-grid';
import '@acrool/react-grid/dist/index.css';


const gridTheme: IGridSetting = {
    spacer: '1rem',
    gridColumns: 12,
    gridBreakpoints: {
        xs: 0,
        sm: 576,
        md: 768,
        lg: 992,
        xl: 1200,
        xxl: 1540,
    },
    containerMaxWidths: {
        sm: 540,
        md: 720,
        lg: 960,
        xl: 1140,
        xxl: 1141,
    },
}


<GridThemeProvider gridTheme={gridTheme}>
    <App/>
</GridThemeProvider>

Override css setting

create folder and file: src/library/acrool-react-grid/grid.scss

@use "@acrool/react-grid/dist/styles.scss" with (

    // 定义断点
    $breakpoints: (
        sm: 576px,
        md: 768px,
        lg: 992px,
        xl: 1200px,
        xxl: 1440px
    ),

    // 网格系统变量
    $grid-gutters: (
        1: 2px,
        2: 4px,
        3: 6px,
        4: 8px,
        5: 10px,
        6: 12px,
        7: 14px,
        8: 16px,
        9: 18px,
        10: 20px,
        11: 22px,
        12: 24px,
        13: 26px,
        14: 28px,
        15: 30px,
        16: 32px,
        17: 34px,
        18: 36px,
        19: 38px,
        20: 40px,
        21: 42px,
        22: 44px,
        23: 46px,
        24: 48px,
        25: 50px,
        26: 52px,
        27: 54px,
        28: 56px,
        29: 58px,
        30: 60px,
        31: 62px,
        32: 64px,
        33: 66px,
        34: 68px,
        35: 70px,
        36: 72px,
        37: 74px,
        38: 76px,
        39: 78px,
        40: 80px,
        41: 82px,
        42: 84px,
        43: 86px,
        44: 88px,
        45: 90px,
        46: 92px,
        47: 94px,
        48: 96px,
        49: 98px,
        50: 100px,
        51: 102px,
        52: 104px,
        53: 106px,
        54: 108px,
        55: 110px,
        56: 112px,
        57: 114px,
        58: 116px,
        59: 118px,
        60: 120px,
        61: 122px,
        62: 124px,
        63: 126px,
        64: 128px,
        65: 130px,
        66: 132px,
        67: 134px,
        68: 136px,
        69: 138px,
        70: 140px,
        71: 142px,
        72: 144px,
        73: 146px,
        74: 148px,
        75: 150px,
        76: 152px,
        77: 154px,
        78: 156px,
        79: 158px,
        80: 160px,
        81: 162px,
        82: 164px,
        83: 166px,
        84: 168px,
        85: 170px,
        86: 172px,
        87: 174px,
        88: 176px,
        89: 178px,
        90: 180px,
        91: 182px,
        92: 184px,
        93: 186px,
        94: 188px,
        95: 190px,
        96: 192px,
        97: 194px,
        98: 196px,
        99: 198px,
        100: 200px
    )
);

Examples

use in your page/component:

import {Container, Row, Col, Grid, Flex, media} from '@acrool/react-grid';

const MyPage = () => {
    return (
        <Container>
            <MyTitle>acrool-react-grid</MyTitle>
            <Desc isVisible={false}>myDesc</Desc>

            <Row>
                <Col col>col2 (50%) </Col>
                <Col col>col2 (50%) </Col>
            </Row>
            <Grid columns={2}>
                <div>Grid Col2</div>

                <Flex className="flex-column gap-2">
                    <div>Grid Col3</div>
                    <div>Grid Col3</div>
                </Flex>


            </Grid>
            <Grid columns="repeat(1, 3fr)">
                <GridCol>Grid Col3</GridCol>
                <GridCol colSpan={2}>Grid Col3</GridCol>
            </Grid>
        </Container>
    );
}

// use rwd
const MyTitle = styled.div`
    font-size: 12px;
    ${media.md`
        font-size: 14px;
    `}
`

// use rwd props
const Desc = styled.div<{
    isVisible: boolean
}>`
    ${props => media.md`
        display: ${props.isVisible ? 'block': 'flex'}
    `}

    // or
    ${props => css`
        font-size: 12px;
        ${media.md`
            display: ${props.isVisible ? 'block': 'flex'}
        `}
    `}
`

MediaConsumer

<MediaConsumer sizes={['xxl']}>
    {(mediaSize)=> {

        if(mediaSize === 'xxl'){
            return <Marquee
                autoFill
                play={hoverId === null}
                className="py-8"
            >
                {renderCards(true)}
            </Marquee>;
        }


        return <Container fluid>
            <Flex column className="gap-8">
                {renderCards(false)}
            </Flex>
        </Container>;
    }}
</MediaConsumer>

There is also a codesandbox template that you can fork and play with it:

Acrool React Grid Template

Use Nextjs example

Acrool React Grid Nextjs Template

There is also a storybook that you can play with it:

Play react-editext-example

Common Props

export interface FCProps {
    id?: string
    style?: CSS.Properties
    className?: string
}

export interface FCChildrenProps extends FCProps {
    children?: ReactNode
}

export interface IFormFieldProps<G extends HTMLElement, T = string> {
    ref?: RefObject<G> | RefCallback<G>
    name?: string
    value?: T
    onChange?: ChangeEventHandler<G>
    placeholder?: string
}

export type TSetState<T> = (newValue: T) => void | Dispatch<SetStateAction<T>>

Experiments

https://github.com/acrool/acrool-frontend-experiments

License

MIT © Acrool & Imagine

changelog

Changelog

All notable changes to this project will be documented in this file. See standard-version for commit guidelines.

6.1.0 (2025-06-15)

6.1.0-alpha.1 (2025-06-15)

6.1.0-alpha.0 (2025-06-15)

Features

  • add overflow control to AutoOverflowAndFlexHeight component and optimize story data (6e173cd)

6.0.9 (2025-05-31)

6.0.9-alpha.0 (2025-05-31)

6.0.8 (2025-05-31)

6.0.8-alpha.1 (2025-05-21)

6.0.8-alpha.0 (2025-05-21)

6.0.7 (2025-05-13)

6.0.6 (2025-05-13)

6.0.6-alpha.0 (2025-05-13)

6.0.5 (2025-05-05)

6.0.5-alpha.3 (2025-05-05)

6.0.5-alpha.2 (2025-05-05)

6.0.5-alpha.1 (2025-05-05)

6.0.5-alpha.0 (2025-04-27)

6.0.4 (2025-04-27)

6.0.4-alpha.2 (2025-04-27)

6.0.4-alpha.1 (2025-04-27)

6.0.4-alpha.0 (2025-04-27)

6.0.3 (2025-04-26)

6.0.3-alpha.0 (2025-04-23)

6.0.2 (2025-04-18)

6.0.2-alpha.2 (2025-04-18)

6.0.2-alpha.1 (2025-04-18)

6.0.2-alpha.0 (2025-04-18)

6.0.1 (2025-04-11)

6.0.0 (2025-04-11)

6.0.0-test.9 (2025-04-11)

6.0.0-test.8 (2025-04-09)

6.0.0-test.7 (2025-04-09)

6.0.0-test.6 (2025-04-09)

6.0.0-test.5 (2025-04-07)

6.0.0-test.4 (2025-04-07)

6.0.0-test.3 (2025-04-07)

6.0.0-test.2 (2025-04-07)

6.0.0-test.1 (2025-04-03)

5.2.6 (2024-12-12)

5.2.6-alpha.0 (2024-10-29)

5.2.5 (2024-10-26)

5.2.5-alpha.1 (2024-10-18)

5.2.5-alpha.0 (2024-10-15)

5.2.4 (2024-09-27)

5.2.4-alpha.0 (2024-09-25)

5.2.3 (2024-08-27)

5.2.3-alpha.0 (2024-08-27)

5.2.2 (2024-07-02)

5.2.2-alpha.0 (2024-07-02)

Bug Fixes

  • 修正 acrool-gutter-5 未定義 (a3f6973)

5.2.1 (2024-06-23)

5.2.1-alpha.3 (2024-06-21)

5.2.1-alpha.2 (2024-06-21)

5.2.1-alpha.1 (2024-06-21)

5.2.1-alpha.0 (2024-06-21)

5.2.0 (2024-06-19)

5.2.0-alpha.3 (2024-06-18)

5.2.0-alpha.2 (2024-06-18)

5.2.0-alpha.1 (2024-06-18)

5.2.0-alpha.0 (2024-06-15)

5.1.0-alpha.0 (2024-06-15)

5.0.14 (2024-05-23)

5.0.14-alpha.3 (2024-05-21)

5.0.14-alpha.2 (2024-05-20)

5.0.14-alpha.1 (2024-05-08)

5.0.14-alpha.0 (2024-05-08)

Bug Fixes

  • @swc/plugin-styled-components dev fail (2fa136f)

5.0.13 (2023-12-20)

5.0.13-alpha.0 (2023-11-30)

Features

  • modify bs 5.2 container gutter is *.5 (ba75d7e)

5.0.12 (2023-11-25)

Features

  • modify text-area-overflow default is 1 line and add .text-area-overflow-2 (a239ac8)

5.0.11 (2023-11-21)

5.0.11-alpha.3 (2023-11-12)

5.0.11-alpha.2 (2023-11-08)

5.0.11-alpha.1 (2023-10-31)

5.0.11-alpha.0 (2023-10-31)

Features

  • add utilities visible css (f4a9094)

5.0.10 (2023-10-30)

5.0.10-alpha.2 (2023-10-27)

5.0.10-alpha.1 (2023-10-26)

Bug Fixes

  • modify container data-grid info and rule (1dd6077)

5.0.10-alpha.0 (2023-10-26)

5.0.9 (2023-10-25)

5.0.9-alpha.7 (2023-10-25)

Features

  • add flex component props col sm md lg xl xxl is direction (1e0a748)

5.0.9-alpha.6 (2023-10-25)

Features

5.0.9-alpha.5 (2023-10-24)

5.0.9-alpha.4 (2023-10-24)

5.0.9-alpha.3 (2023-10-24)

Bug Fixes

  • miss modify style notice (f641a56)

5.0.9-alpha.2 (2023-10-24)

Features

  • modify .gap-column change to .column-gap (71a53e8)

5.0.9-alpha.1 (2023-10-24)

Features

  • remove GirdCol, change use g-col-? class (9bb9d86)

5.0.9-alpha.0 (2023-10-23)

Features

  • remove GridRow, data-grid info, add grid-flow (c696d40)

5.0.8 (2023-10-23)

Bug Fixes

  • modify style g-? is not use important! and add test (d0ce18d)

5.0.7 (2023-10-19)

Bug Fixes

5.0.6-alpha.1 (2023-10-17)

5.0.6-alpha.0 (2023-10-17)

Features

  • add grid-auto-flow props [autoFlow=column,row] (8345999)

5.0.5 (2023-10-08)

5.0.5-alpha.0 (2023-10-07)

Features

  • add d-contents utils class css (5e2b9f3)

5.0.4 (2023-10-06)

5.0.4-alpha.15 (2023-10-06)

5.0.4-alpha.14 (2023-10-06)

Features

  • add utils repeat, minmax and use in grid cssGetter (c934495)

5.0.4-alpha.13 (2023-10-06)

5.0.4-alpha.12 (2023-10-05)

Features

  • add utils class filter-gray (7091f55)

5.0.4-alpha.11 (2023-10-05)

Features

  • add utils css text-overflow (7f62b0a)

5.0.4-alpha.10 (2023-10-05)

5.0.4-alpha.9 (2023-10-04)

5.0.4-alpha.8 (2023-10-04)

Bug Fixes

  • fix columnsGap -> columnGap, and rows is same, check 0 not undefined (3480647)

5.0.4-alpha.7 (2023-10-04)

Bug Fixes

5.0.4-alpha.6 (2023-10-04)

5.0.4-alpha.5 (2023-10-04)

5.0.4-alpha.4 (2023-10-04)

5.0.4-alpha.3 (2023-10-03)

5.0.4-alpha.2 (2023-10-03)

5.0.4-alpha.1 (2023-10-03)

5.0.4-alpha.0 (2023-10-03)

5.0.3 (2023-10-02)

Features

  • add container fluid rwd config (5041e52)

5.0.3-alpha.8 (2023-09-26)

5.0.3-alpha.7 (2023-09-23)

Bug Fixes

  • gird parent overwrite css var (d75710e)

5.0.3-alpha.6 (2023-09-22)

Features

  • add justify-items, fix justify-content-center attr (cf79186)

5.0.3-alpha.5 (2023-09-21)

Bug Fixes

  • fix JSX.Element to ReactNode (106d41d)

5.0.3-alpha.4 (2023-09-21)

Bug Fixes

  • fix ReactNode to JSX.Element (e4a554f)

5.0.3-alpha.3 (2023-09-20)

5.0.3-alpha.2 (2023-09-20)

Features

  • add utils css order first last (745d561)

5.0.3-alpha.1 (2023-09-19)

5.0.3-alpha.0 (2023-09-19)

Bug Fixes

  • fix p-{size}-0 ~ 5 css, and add p-0 ~ 5 (fcab169)

5.0.2 (2023-09-18)

Features

  • remove bear custom row-x y (6728e63)

5.0.2-alpha.8 (2023-09-18)

Bug Fixes

  • no package.json type module by nextjs (ba18d12)

5.0.2-alpha.7 (2023-09-18)

5.0.2-alpha.6 (2023-09-18)

5.0.2-alpha.5 (2023-09-18)

5.0.2-alpha.4 (2023-09-18)

5.0.2-alpha.3 (2023-09-18)

5.0.2-alpha.2 (2023-09-17)

5.0.2-alpha.1 (2023-09-17)

5.0.2-alpha.0 (2023-09-17)

Bug Fixes

  • fix utils p- css, rounded var to -> .25rem, bear custom (77ada83)

5.0.1 (2023-09-14)

Bug Fixes

5.0.0 (2023-09-13)

Features

  • add row grid, args: horizontal vertical (bdc5a32)

5.0.0-alpha.7 (2023-09-12)

Bug Fixes

  • fix col 樣式覆蓋不掉問題 (1726ade)

5.0.0-alpha.6 (2023-09-12)

5.0.0-alpha.5 (2023-09-12)

Bug Fixes

5.0.0-alpha.4 (2023-09-12)

Bug Fixes

  • fix TGutterWidth no number (4416b29)

5.0.0-alpha.3 (2023-09-12)

Features

5.0.0-alpha.2 (2023-09-11)

Bug Fixes

  • fix styled-component vite 設定導致 @media 讀取不到 version (424b366)

5.0.0-alpha.1 (2023-09-11)

5.0.0-alpha.0 (2023-09-11)

4.2.1 (2023-09-10)

4.2.1-alpha.2 (2023-09-10)

4.2.1-alpha.1 (2023-09-10)

4.2.1-alpha.0 (2023-09-10)

Bug Fixes

4.2.0 (2023-09-10)

4.1.0 (2023-09-09)

Features

  • add stats.html to gitignore (077f81b)

Bug Fixes

  • fix handleSetCollapse event.stopPropagation() (0893e38)

4.1.0-alpha.0 (2023-09-09)

Features

Bug Fixes

4.0.2-alpha.1 (2023-09-09)

Bug Fixes

  • fix primary-color css var (a3847a4)

4.0.2-alpha.0 (2023-09-09)

Bug Fixes

4.0.1 (2023-09-09)

Features

4.0.0 (2023-09-09)

4.0.0-alpha.0 (2023-09-08)

Features

  • add feature grid and table tag (f3b3c0f)

3.0.1-alpha.8 (2023-07-04)

Features

  • add not data render in div.elClassNames.notData (3f9e34f)

3.0.1-alpha.7 (2023-06-28)

Bug Fixes

3.0.1-alpha.6 (2023-06-28)

Features

3.0.1-alpha.5 (2023-06-28)

Features

3.0.1-aplha.4 (2023-06-27)

Features

  • disabled mobile hover style (c3a13ad)

3.0.1-aplha.3 (2023-06-27)

Features

3.0.1-aplha.2 (2023-06-27)

Bug Fixes

  • fix ElClassName -> elClassName (2d37100)

3.0.1-aplha.1 (2023-06-27)

3.0.1-aplha.0 (2023-06-27)

Features