Epicmax - We are the core team behind Vuestic UI and Vuestic Admin and frontend development company specializing in Vue.js since our founding in 2017.

Layout
#

layoutapp layoutpage layout

Component is used for building App layout. It is based on CSS Grid and provides a simple API for building complex layouts.

VaLayout component could be used in pair with VaSidebar, VaNavbar components.

Component provides four slots called area (top, right, bottom, left) and content (or default). You can specify area config for each slot which changes its behavior. For example, you can make area fixed or absolute. You can also change order of areas. See examples bellow for more details.

Ready to use templates
#

Here is a list of common app layouts. You can copy and use them as a starting point for your application. All templates are responsive and mobile friendly.

Examples
#

In examples bellow you can learn how to configure Layout component exactly for your needs if you don't like templates from above.

Default usage
#

Default usage of Layout component.

LOGO

Page 1

Page content must be wrapped in main tag. You must do it manually. Here you can place any blocks you need in your application.

For example, you can place here your router view, add sidebar with navigation in #left slot.

If you're using VaSidebar for page navigation don't forget to wrap it in nav tag.

Open in GitHub

All slots
#

Layout component has 4 slots: top, right, bottom, left, content (or default). You can use them to place your content.

#top
#left
#right
#bottom
#content
Open in GitHub

Rendering order
#

You can use order area attribute to change order of slots.If order of one area is higher than another, it will be rendered on top of it. For example, if you set top order to 0 and left to 1, left will take area from top. It is easier to play with it in example bellow.

LOGO
Footer

Page content

Page content must be wrapped in main tag. You must do it manually. Here you can place any blocks you need in your application.

For example, you can place here your router view, add sidebar with navigation in #left slot.

If you're using VaSidebar for page navigation don't forget to wrap it in nav tag.

Open in GitHub

Absolute
#

You can use absolute area attribute to make area absolute. It will be rendered on top of other areas and overflow them. Absolute respect order prop.

LOGO

Page content

Page content must be wrapped in main tag. You must do it manually. Here you can place any blocks you need in your application.

For example, you can place here your router view, add sidebar with navigation in #left slot.

If you're using VaSidebar for page navigation don't forget to wrap it in nav tag.

Open in GitHub

Fixed
#

You can use fixed area attribute to make area fixed. Fixed will force area to stay on its place during scrolling. Fixed respect order prop.

Open in GitHub

Mobile friendly
#

It is recommended to make left and right areas absolute on mobile devices. You can use absolute prop to do it in pair with useBreakpoint composable.

LOGO

Page content

Page content must be wrapped in main tag. You must do it manually. Here you can place any blocks you need in your application.

For example, you can place here your router view, add sidebar with navigation in #left slot.

If you're using VaSidebar for page navigation don't forget to wrap it in nav tag.

Open in GitHub

Accessibility
#

Layout component is not handling accessibility by default.

You should always wrap content in slot with <div role="region" aria-label="..."> to make it accessible. Make sure you have main role on your main content in content slot, aside in left, right slots, header in top slot and footer in bottom slot. More about landmarks you can read here.

Notice that if you're using components like VaSidebar, VaHeader the correct role will be added automatically.

Props #

NameDescriptionTypesDefault
allowBodyScrollOnOverlay

Boolean

false

bottom

AreaConfig for bottom slot

{ absolute?: boolean, order?: number, fixed?: boolean, overlay?: boolean }

{
  "order": 2
}
left

AreaConfig for left slot

{ absolute?: boolean, order?: number, fixed?: boolean, overlay?: boolean }

{
  "order": 1
}
right

AreaConfig for right slot

{ absolute?: boolean, order?: number, fixed?: boolean, overlay?: boolean }

{
  "order": 1
}
top

AreaConfig for top slot

{ absolute?: boolean, order?: number, fixed?: boolean, overlay?: boolean }

{
  "order": 2
}

Events #

NameDescription

bottomOverlayClick

Emitted when bottom overlay is clicked.

leftOverlayClick

Emitted when left overlay is clicked. Can be used to close sidebar on mobile devices.

rightOverlayClick

Emitted when right overlay is clicked. Can be used to close sidebar on mobile devices.

topOverlayClick

Emitted when top overlay is clicked

Css Variables #

NameDefault Value
--va-layout-overlay-color rgba(0, 0, 0, 0.5)
--va-layout-scroll-padding 1rem