跳至主要内容

設定

網格佈局相關設置

import {GridThemeProvider, IGridSetting} from '@acrool/react-grid';

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: 1540,
},
};

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

請勿在下層再次使用 GridThemeProvider 造成二次產生 :root 參數覆蓋原本參數

Props

Props NameTypeRequiredDefaultDescription
childrenReactNode
gridThemeIGridSettingin example網格佈局相關設置

IGridSetting

Props NameTypeRequiredDefaultDescription
spacerstringin examplepadding, grid, gap base unit
gridColumnsnumberin example網格系統 col 總數
gridBreakpointsIBreakpointsin example網格系統斷點尺寸
containerMaxWidthsTContainerMaxWidthsin example網格系統容器最大寬度

IBreakpoints

{
xs: number
sm: number
md: number
lg: number
xl: number
xxl: number
}

TMediaSize

'xs'|'sm'|'md'|'lg'|'xl'|'xxl'

TContainerMaxWidths

Omit<IBreakpoints, 'xs'>