Container
Brief Introduction
The Container component is used to wrap other content and provide layout and style control. There are five tags available: <MYContainer></MYContainer> and <MYContainer />: Basic container<MYHeader></MYHeader> and <MYHeader />: Page header<MYAside></MYAside> and <MYAside />: Sidebar<MYMain></MYMain> and <MYMain />: Main content<MYFooter></MYFooter> and <MYFooter />: Footer
Container Usage
Basic Container
Use <MYContainer></MYContainer> to implement a container.
Code Demo
Basic Container
This is a basic container
展开代码
Custom Styled Container
Basic container with custom styles:
Code Demo
Container with Custom Styles
Container with custom height, width, and background color
展开代码
Complete Layout
Complete layout example (width, height, colors can be freely adjusted):
Code Demo
Complete Layout
Main Content Area
Various content can be placed here
展开代码
API Reference
MYContainer Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| height | Height | string/number | px/em/rem/dynamic | — |
| width | Width | string/number | px/em/rem/dynamic/% | — |
| background | Background color | string | Hex or named color | — |
| tag | Container tag | string | Any HTML tag | div |
MYHeader Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| height | Height | string/number | px/em/rem/dynamic | — |
| width | Width | string/number | px/em/rem/dynamic/% | — |
| background | Background color | string | Hex or named color | — |
| fixed | Fixed header navigation | boolean | — | false |
| tag | Container tag | string | Any HTML tag | header |
MYAside Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| height | Height | string/number | px/em/rem/dynamic | — |
| width | Width | string/number | px/em/rem/dynamic/% | — |
| background | Background color | string | Hex or named color | — |
| position | Sidebar position | string | left/right | left |
| tag | Container tag | string | Any HTML tag | aside |
MYMain Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| height | Height | string/number | px/em/rem/dynamic | — |
| width | Width | string/number | px/em/rem/dynamic/% | — |
| background | Background color | string | Hex or named color | — |
| tag | Container tag | string | Any HTML tag | main |
MYFooter Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| height | Height | string/number | px/em/rem/dynamic | — |
| width | Width | string/number | px/em/rem/dynamic/% | — |
| background | Background color | string | Hex or named color | — |
| tag | Container tag | string | Any HTML tag | footer |
Type Definitions
typescript
interface ContainerProps {
height?: string | number;
width?: string | number;
background?: string;
tag?: string;
}
interface HeaderProps {
height?: string | number;
width?: string | number;
background?: string;
fixed?: boolean;
tag?: string;
}
interface AsideProps {
height?: string | number;
width?: string | number;
background?: string;
tag?: string;
position?: "left" | "right";
}
interface MainProps {
height?: string | number;
width?: string | number;
background?: string;
tag?: string;
}
interface FooterProps {
height?: string | number;
width?: string | number;
background?: string;
tag?: string;
}