Layout
Quickly and easily create layouts with the basic 24-column.
TIP
The component uses flex layout by default, no need to set type="flex"
manually.
Please note that the parent container should avoid using inline
related styles, which will cause the component to not fill up its width.
Basic layout
Create basic grid layout using columns.
With row
and col
, we can easily manipulate the layout using the span
attribute.
Column spacing
Column spacing is supported.
Row provides gutter
attribute to specify spacings between columns, and its default value is 0.
Hybrid layout
Form a more complex hybrid layout by combining the basic 1/24 columns.
Column offset
You can specify column offsets.
You can specify the number of column offset by setting the value of offset
attribute of Col.
Alignment
Default use the flex layout to make flexible alignment of columns.
You can define the layout of child elements by setting justify
attribute with start, center, end, space-between, space-around or space-evenly.
Responsive Layout
Taking example by Bootstrap's responsive design, five breakpoints are preset: xs, sm, md, lg and xl.
Utility classes for hiding elements
Additionally, Element Plus provides a series of classes for hiding elements under certain conditions. These classes can be added to any DOM elements or custom components. You need to import the following CSS file to use these classes:
import 'element-plus/theme-chalk/display.css'
The classes are:
hidden-xs-only
- hide when on extra small viewports onlyhidden-sm-only
- hide when on small viewports onlyhidden-sm-and-down
- hide when on small viewports and downhidden-sm-and-up
- hide when on small viewports and uphidden-md-only
- hide when on medium viewports onlyhidden-md-and-down
- hide when on medium viewports and downhidden-md-and-up
- hide when on medium viewports and uphidden-lg-only
- hide when on large viewports onlyhidden-lg-and-down
- hide when on large viewports and downhidden-lg-and-up
- hide when on large viewports and uphidden-xl-only
- hide when on extra large viewports only
Row API
Row Attributes
Name | Description | Type | Default |
---|---|---|---|
gutter | grid spacing | number | 0 |
justify | horizontal alignment of flex layout | enum | start |
align | vertical alignment of flex layout | enum | — |
tag | custom element tag | string | div |
Row Slots
Name | Description | Subtags |
---|---|---|
default | customize default content | Col |
Col API
Col Attributes
Name | Description | Type | Default |
---|---|---|---|
span | number of column the grid spans | number | 24 |
offset | number of spacing on the left side of the grid | number | 0 |
push | number of columns that grid moves to the right | number | 0 |
pull | number of columns that grid moves to the left | number | 0 |
xs | <768px Responsive columns or column props object | number / object | — |
sm | ≥768px Responsive columns or column props object | number / object | — |
md | ≥992px Responsive columns or column props object | number / object | — |
lg | ≥1200px Responsive columns or column props object | number / object | — |
xl | ≥1920px Responsive columns or column props object | number / object | — |
tag | custom element tag | string | div |
Col Slots
Name | Description |
---|---|
default | customize default content |