Skip to content

Display

Image :: struct {...}
Pixel :: [4]u8
chips :: proc{chips_index, chips_enum}
avatar :: proc(name: string, large := false)
badge :: proc(label: string, tone := Tone.Default, dot := false)
callout :: proc(tone := Tone.Info, title := "") -> bool
chip :: proc(label: string, selected: bool, disabled := false) -> bool
chips_enum :: proc(selected: $E, labels: [E]string) -> (E, bool) where intrinsics.type_is_enum(E)
chips_index :: proc(selected: int, labels: []string) -> (int, bool)
empty_state :: proc(title: string, text: string) -> bool
image :: proc(img: Image, width: f32 = 0, height: f32 = 0)
progress :: proc(value: f32, tone := Tone.Primary, color: Maybe(Color) = nil, thin := false)
spinner :: proc()
stat :: proc(label, value: string, note := "", delta := "", delta_tone := Tone.Default, large := false)
text :: proc(s: string, style := TextStyle.Body, tone := Tone.Default, ellipsis := false)
Image :: struct {
handle: rawptr,
width, height: int,
}

Pixel data and backend handle of an image. Create it after the window opened (in init).

FieldTypeNotes
handlerawptr
widthint
heightint

Source: kiln/display.odin:231

Pixel :: [4]u8

One RGBA pixel.

Source: kiln/display.odin:237

chips :: proc{chips_index, chips_enum}

A single choice from chips that wrap into lines (a flow).

Calls one of these, depending on the argument types:

  • chips_index proc(selected: int, labels: []string) -> (int, bool)
  • chips_enum proc(selected: $E, labels: [E]string) -> (E, bool) where intrinsics.type_is_enum(E)

Source: kiln/extras.odin:110

avatar :: proc(name: string, large := false)

A circle with the initials of name; its color is derived from the name.

ArgumentTypeDefault
namestringrequired
largeboolfalse

Source: kiln/display.odin:126

badge :: proc(label: string, tone := Tone.Default, dot := false)

A small pill for status and counts. dot adds a leading circle (e.g. online status).

kiln.badge("Neu", .Primary)
kiln.badge("Online", .Success, dot = true)
ArgumentTypeDefault
labelstringrequired
toneToneTone.Default
dotboolfalse

Source: kiln/display.odin:89

callout :: proc(tone := Tone.Info, title := "") -> bool

A tinted box with an accent bar on the left for messages in the page (errors, hints, “connected”). The block holds text and buttons:

if kiln.callout(.Danger, "Konnte nicht laden") {
kiln.text(m.error)
if kiln.button("Nochmal", .Secondary) {append(out, Retry{})}
}
ArgumentTypeDefault
toneToneTone.Info
titlestring""
ReturnsType
#0bool

Source: kiln/extras.odin:16

chip :: proc(label: string, selected: bool, disabled := false) -> bool

A pill that toggles, e.g. a filter. Returns true when clicked; the caller flips selected:

if kiln.chip("Nur offene", m.only_open) {append(out, Toggle_Open{})}
ArgumentTypeDefault
labelstringrequired
selectedboolrequired
disabledboolfalse
ReturnsType
#0bool

Source: kiln/extras.odin:70

chips_enum :: proc(selected: $E, labels: [E]string) -> (E, bool) where intrinsics.type_is_enum(E)
ArgumentTypeDefault
selected$Erequired
labels[E]stringrequired
ReturnsType
#0E
#1bool

Source: kiln/extras.odin:127

chips_index :: proc(selected: int, labels: []string) -> (int, bool)
ArgumentTypeDefault
selectedintrequired
labels[]stringrequired
ReturnsType
#0int
#1bool

Source: kiln/extras.odin:115

empty_state :: proc(title: string, text: string) -> bool

A centered, muted message for an empty list or page; the block can hold an action button:

if kiln.empty_state("Keine Aufgaben", "Lege oben die erste an.") {
if kiln.button("Beispiele laden", .Secondary) {append(out, Load_Examples{})}
}
ArgumentTypeDefault
titlestringrequired
textstringrequired
ReturnsType
#0bool

Source: kiln/extras.odin:42

image :: proc(img: Image, width: f32 = 0, height: f32 = 0)

An image (see create_image / load_image). Without a size it fills the available width and keeps its aspect ratio; with one of width / height (units) the other one follows.

ArgumentTypeDefault
imgImagerequired
widthf320
heightf320

Source: kiln/display.odin:207

progress :: proc(value: f32, tone := Tone.Primary, color: Maybe(Color) = nil, thin := false)

A progress bar, value in [0, 1]. The bar follows changes smoothly. color overrides the tone (e.g. a category color from chart_color), thin halves the height for dense lists.

ArgumentTypeDefault
valuef32required
toneToneTone.Primary
colorMaybe(Color)nil
thinboolfalse

Source: kiln/display.odin:159

spinner :: proc()

A loading indicator: three dots that pulse one after another.

Source: kiln/display.odin:184

stat :: proc(
label, value: string,
note := "",
delta := "",
delta_tone := Tone.Default,
large := false,
)

A key figure: a caption, the value, and optionally a change badge and a note. Fits into grid cells:

kiln.stat("Bildschirmzeit", "5h 8m", delta = "↓ 12 %", delta_tone = .Success, large = true)
ArgumentTypeDefault
labelstringrequired
valuestringrequired
notestring""
deltastring""
delta_toneToneTone.Default
largeboolfalse

Source: kiln/extras.odin:137

text :: proc(s: string, style := TextStyle.Body, tone := Tone.Default, ellipsis := false)

Text in a style and tone. It wraps at word boundaries when the container is too narrow; with ellipsis it stays on one line and is cut with ”…” instead (the full text then shows as tooltip).

kiln.text("Einstellungen", .Title)
kiln.text("Zuletzt geändert vor 3 Minuten", .Caption, .Muted)
kiln.text(window.title, ellipsis = true)
ArgumentTypeDefault
sstringrequired
styleTextStyleTextStyle.Body
toneToneTone.Default
ellipsisboolfalse

Source: kiln/display.odin:18