Typography

Laying out your content

For demonstrative purposes, this tutorial uses an AbstractCard to make the text examples clearer. A better way to achieve the same results would be to use a Kirigami Addons FormCard.

Headings

Kirigami provides a Heading that can be used for page or section titles.

import QtQuick
import QtQuick.Layouts
import org.kde.kirigami as Kirigami

Kirigami.ApplicationWindow {
    title: "Kirigami Heading"
    height: 400
    width: 400

    pageStack.initialPage: Kirigami.Page {
        Kirigami.AbstractCard {
            anchors.fill: parent
            contentItem: ColumnLayout {
                anchors.fill: parent
                Kirigami.Heading {
                    text: "Heading level 1"
                    level: 1
                }
                Kirigami.Heading {
                    text: "Heading level 2"
                    level: 2
                }
                Kirigami.Heading {
                    text: "Heading level 3"
                    level: 3
                }
                Kirigami.Heading {
                    text: "Heading level 4"
                    level: 4
                }
                Kirigami.Heading {
                    text: "Heading level 5"
                    level: 5
                }
            }
        }
    }
}
Five headings with different levels for size comparison

Labels

Text elements should use the Label component from QtQuick Controls 2.

Heading and lorem ipsum text aligned to the horizontal center

Text Alignment

You can align your text elements using the horizontalAlignment and verticalAlignment properties.

Heading and lorem ipsum text aligned to the horizontal center
Heading and lorem ipsum text using right-aligned text
Heading with bottom vertical alignment and lorem ipsum text with top vertical alignment
Heading with top vertical alignment and lorem ipsum text with bottom vertical alignment

Rich Text

QML allows you to display (and edit) rich text. The behavior can be controlled via the textFormat property.

A Label containing a list of fruits using HTML tags like paragraph, unordered lists and bold fonts

Theme

The font size of the Kirigami.Theme is available as Kirigami.Theme.defaultFont.pointSize in your application.

Last updated