Skip to content

Container Layout

Container components used for layout, making it easy to quickly build the basic structure of a page. It is based on Flexbox and includes YhContainer, YhHeader, YhAside, YhMain, and YhFooter.

Common Page Layouts

Header + Main

Header
Main
Header + Main

Aside + Main

Main
Aside + Main

Full Layout

Classic admin layout with Header + Aside + Main + Footer. YhContainer automatically switches to a vertical layout when it detects YhHeader or YhFooter children.

Header
Main
Footer
Full Layout

Use in Nuxt

These layout components work in Nuxt 3/4 after registering @yh-ui/nuxt. A common pattern is to place them in layouts/default.vue and render route content through NuxtPage.

My App

Current Route Content (NuxtPage)
© 2024 YH-UI
Nuxt Usage (layouts/default.vue)

SSR Notes:

  • All props and inline styles are rendered consistently during SSR.
  • Automatic layout direction detection remains stable after hydration.
  • Slot content and nested layouts stay aligned across server and client rendering.

SSR Safety

All container sub-components have passed SSR validation, so server-rendered and hydrated output stay consistent.

API

Props

Container

PropDescriptionTypeDefault
directionArrangement direction'horizontal' | 'vertical'Auto-detect
theme-overridesComponent-level theme variable overridesComponentThemeVarsundefined
PropDescriptionTypeDefault
heightHeader heightstring'60px'
theme-overridesComponent-level theme variable overridesComponentThemeVarsundefined

Aside

PropDescriptionTypeDefault
widthSidebar widthstring'200px'
theme-overridesComponent-level theme variable overridesComponentThemeVarsundefined

Main

PropDescriptionTypeDefault
theme-overridesComponent-level theme variable overridesComponentThemeVarsundefined
PropDescriptionTypeDefault
heightFooter heightstring'60px'
theme-overridesComponent-level theme variable overridesComponentThemeVarsundefined

Events

YhContainer, YhHeader, YhAside, YhMain, and YhFooter do not expose component events.

Slots

Container

SlotDescriptionParameters
defaultContainer content.-

Header

SlotDescriptionParameters
defaultHeader content.-

Aside

SlotDescriptionParameters
defaultAside content.-

Main

SlotDescriptionParameters
defaultMain content.-
SlotDescriptionParameters
defaultFooter content.-

Expose

These layout components do not expose public instance methods or properties.

Theme Variables

Variable NameDescriptionDefault
--yh-header-paddingHeader padding0 20px
--yh-header-bg-colorHeader background colortransparent
--yh-header-border-bottomHeader bottom bordernone
--yh-aside-bg-colorSidebar background colortransparent
--yh-aside-border-rightSidebar right bordernone
--yh-main-paddingMain area padding20px
--yh-main-bg-colorMain area background colortransparent
--yh-footer-paddingFooter padding0 20px
--yh-footer-bg-colorFooter background colortransparent
--yh-footer-border-topFooter top bordernone

Type Exports

NameDescription
YhContainerPropsProps type for YhContainer
YhHeaderPropsProps type for YhHeader
YhAsidePropsProps type for YhAside
YhMainPropsProps type for YhMain
YhFooterPropsProps type for YhFooter
YhContainerSlotsSlots type for YhContainer
YhHeaderSlotsSlots type for YhHeader
YhAsideSlotsSlots type for YhAside
YhMainSlotsSlots type for YhMain
YhFooterSlotsSlots type for YhFooter
YhContainerInstancePublic instance type for YhContainer
YhHeaderInstancePublic instance type for YhHeader
YhAsideInstancePublic instance type for YhAside
YhMainInstancePublic instance type for YhMain
YhFooterInstancePublic instance type for YhFooter

Released under the MIT License.