Skip to content

Layout ​

Brief Introduction ​

The Layout component is used to quickly build page layout structures. mengyue-components provides flexible layout solutions, supporting grid systems and multiple alignment methods. You can use <MYRow></MYRow> and <MYCol></MYCol> to implement layouts.

Basic Usage ​

Basic Grid Layout ​

Use the <MYRow></MYRow> and <MYCol></MYCol> tags to build a basic grid layout system.

Code Demo
span=6
span=12
span=6
展开代码

Spacing Control ​

Use the gutter property to set the spacing between grids.

Code Demo
Left
Center
Right
展开代码

Horizontal Alignment ​

Use the justify property to set the horizontal alignment.

Code Demo
Left
Right
展开代码

Vertical Centering ​

Use the align property to set vertical centering, and alignCenter to set both horizontal and vertical centering.

Code Demo
Top
Middle
Bottom
展开代码

Direction Reversal ​

Use the direction property to set the layout direction.

Code Demo
1 (Visually on the right)
2
3 (Visually on the left)
展开代码

API Reference ​

MYRow Props ​

ParameterDescriptionTypeOptionsDefault
gutterGrid spacingnumber/string0-240
justifyHorizontal alignmentstringstart / end / center / space-around / space-between—
alignVertical alignmentboolean—false
alignCenterVertical & horizontal centerboolean—false
directionLayout directionstringrow / column / row-reverse / column-reverserow
tagRender tagstringSupports all HTML tagsdiv

MYCol Props ​

ParameterDescriptionTypeOptionsDefault
spanGrid widthnumber1-2424
offsetLeftLeft offsetnumber/string0-240
offsetRightRight offsetnumber/string0-240
pullMove leftnumber/string0-240
pushMove rightnumber/string0-240
tagRender tagstringSupports all HTML tagsdiv

Type Definitions ​

typescript
interface RowProps {
  gutter?: number | string;
  justify?: 'start' | 'end' | 'center' | 'space-around' | 'space-between';
  align?: boolean;
  alignCenter?: boolean;
  direction?: 'row' | 'column' | 'row-reverse' | 'column-reverse';
  tag?: string;
}

interface ColProps {
  span?: number;
  offsetLeft?: number | string;
  offsetRight?: number | string;
  pull?: number | string;
  push?: number | string;
  tag?: string;
}

Released under the MIT License.