Skip to content
On this page

Layout

Container components for layouts to quickly build the basic structure of a page.

Overview of components

There are five components: <kl-layout>,<kl-header>,<kl-main>,<kl-footer>,and <kl-aside>.

<kl-layout>:Outer container. Note: When a child element contains <kl-header>or <kl-footer>, all child elements are arranged vertically from top to bottom, and the rest horizontally left and right.

<kl-header>:Topbar container。

<kl-main>:The primary content container。

<kl-footer>:Bottom bar container。

<kl-aside>:Sidebar container。

Among them, <kl-header> and <kl-footer>can customize the height through the height property name, <kl-aside> can customize the width through the width property name, see the API area for details。

Common layouts

kl-header
kl-main
<>
<template>
    <kl-layout class="common-layout box">
        <kl-header>kl-header</kl-header>
        <kl-main>kl-main</kl-main>
    </kl-layout>
</template>

<script setup lang="ts"></script>
<style></style>

kl-header
kl-main
kl-footer
<>
<template>
    <kl-layout class="common-layout box">
        <kl-header>kl-header</kl-header>
        <kl-main>kl-main</kl-main>
        <kl-footer>kl-footer</kl-footer>
    </kl-layout>
</template>

<script setup lang="ts"></script>
<style></style>

kl-main
<>
<template>
    <kl-layout class="common-layout box">
        <kl-aside width="200px">kl-aside</kl-aside>
        <kl-main>kl-main</kl-main>
    </kl-layout>
</template>

<script setup lang="ts"></script>
<style></style>

kl-header
kl-main
<>
<template>
    <kl-layout class="common-layout box">
        <kl-header>kl-header</kl-header>
        <kl-layout>
            <kl-aside width="200px">kl-aside</kl-aside>
            <kl-main>kl-main</kl-main>
        </kl-layout>
    </kl-layout>
</template>

<script setup lang="ts"></script>
<style></style>

kl-header
kl-main
kl-footer
<>
<template>
    <kl-layout class="common-layout box">
        <kl-header>kl-header</kl-header>
        <kl-layout>
            <kl-aside width="200px">kl-aside</kl-aside>
            <kl-layout>
                <kl-main>kl-main</kl-main>
                <kl-footer>kl-footer</kl-footer>
            </kl-layout>
        </kl-layout>
    </kl-layout>
</template>

<script setup lang="ts"></script>
<style></style>

kl-header
kl-main
<>
<template>
    <kl-layout class="common-layout box">
        <kl-aside width="200px">kl-aside</kl-aside>
        <kl-layout>
            <kl-header>kl-header</kl-header>
            <kl-main>kl-main</kl-main>
        </kl-layout>
    </kl-layout>
</template>

<script setup lang="ts"></script>
<style></style>

Layout API

Layout Attributes

The property namedescriptiontypeDefault value
directionThe direction in which child elements are arrangedstringIf there are kl-header or kl-footer in the child elements, vertical and the rest horizontal

Layout Slots

Slot namedescriptionSublabels
defaultCustomize contentLayout/Header/Footer/Aside/Main

Header/Footer API

The property namedescriptiontypeDefault value
heightTop bar heightstring60px
Slot namedescription
defaultCustomize content

Aside API

Aside Attributes

The property namedescriptiontypeDefault value
widthTop bar widthstring200px

Aside Slots

Slot namedescription
defaultCustomize content

Main API

Aside Slots

Slot namedescription
defaultCustomize content

Released under the MIT License.