Skip to content

aivi.gtk.styles

Typed constants for GTK4 and libadwaita CSS utility class names, plus a classes helper for combining them.

Use these with the cssClasses attribute on any widget instead of writing raw strings. They are the exact class names that GTK4 and libadwaita define; AIVI passes them directly to the widget's CSS engine.

Import

aivi
use aivi.gtk.styles (
    suggestedAction
    title1
    dimLabel
    classes
)

Overview

NameTypeDescription
title1Text"title-1" — display-size heading
title2Text"title-2" — large section heading
title3Text"title-3" — medium section heading
title4Text"title-4" — small/bold subheading
headingText"heading" — standard heading weight
captionText"caption" — small secondary text
captionHeadingText"caption-heading" — bold caption scale
numericText"numeric" — uniform-width digit rendering
suggestedActionText"suggested-action" — primary CTA button (accent colour)
destructiveActionText"destructive-action" — danger/irreversible action
flatStyleText"flat" — no background or frame
circularText"circular" — equal width and height, circle shape
pillText"pill" — fully rounded ends
raisedText"raised" — slight surface elevation
linkedText"linked" — removes gap between adjacent buttons
osdText"osd" — dark semi-transparent on-screen-display style
successText"success" — green confirmation tint
warningText"warning" — yellow warning tint
errorStyleText"error" — red error/destructive tint
accentText"accent" — follows system or app accent hue
dimLabelText"dim-label" — reduced-opacity secondary text
cardText"card" — rounded card surface
boxedListText"boxed-list" — bordered, rounded ListBox rows
toolbarText"toolbar" — toolbar surface
frameStyleText"frame" — thin container border
backgroundStyleText"background" — app background layer
viewStyleText"view" — primary reading/editing surface
undershootText"undershoot" — scrolled-content overlay hint
classesList Text -> TextCombines names into a space-separated string

Basic usage

aivi
use aivi.gtk.styles (
    suggestedAction
    destructiveAction
    title1
    dimLabel
)

value view =
    <Window title="Demo">
        <Box orientation="Vertical" spacing={12} marginTop={24} marginStart={24} marginEnd={24}>
            <Label text="Welcome" cssClasses={title1} />
            <Label text="Secondary info" cssClasses={dimLabel} />
            <Box orientation="Horizontal" spacing={8}>
                <Button label="Save" cssClasses={suggestedAction} />
                <Button label="Delete" cssClasses={destructiveAction} />
            </Box>
        </Box>
    </Window>

Combining multiple classes

Use classes to join several class names into a single space-separated value:

aivi
use aivi.gtk.styles (
    circular
    flatStyle
    osd
    classes
)

value iconButtonClasses : Text =
    classes [
        circular,
        flatStyle
    ]

value view = <Button iconName="list-add-symbolic" cssClasses={iconButtonClasses} />

Boxed preference list

aivi
use aivi.gtk.styles (boxedList)

value view =
    <Window title="Settings">
        <Box orientation="Vertical" marginTop={24} marginStart={24} marginEnd={24}>
            <ListBox selectionMode="None" cssClasses={boxedList}>
                <SwitchRow title="Enable notifications" active={True} />
                <SwitchRow title="Dark mode" active={False} />
            </ListBox>
        </Box>
    </Window>

Card surface

aivi
use aivi.gtk.styles (card)

value view =
    <Window title="Cards">
        <Box orientation="Vertical" spacing={12} marginTop={16} marginStart={16} marginEnd={16}>
            <Box orientation="Vertical" cssClasses={card} marginStart={8} marginEnd={8} marginTop={8} marginBottom={8}>
                <Label text="Card title" cssClasses="heading" />
                <Label text="Card body text goes here." />
            </Box>
        </Box>
    </Window>

Notes

  • Every constant is a plain Text value — you can use them anywhere a Text expression is expected.
  • cssClasses on any widget accepts a whitespace-separated string; classes produces exactly that.
  • These are the real GTK4/libadwaita CSS class names; refer to the Adwaita stylesheet documentation for the full catalogue and visual reference.

(c) 2026 by Andreas Herd