Skip to content

Overlays

MenuItem :: struct {...}
TooltipSide :: enum {...}
menu :: proc{menu_label, menu_icon}
context_menu :: proc(items: []MenuItem) -> (index: int, ok: bool)
dialog :: proc(name: string, title: string) -> bool
drawer :: proc(name: string) -> bool
menu_icon :: proc(icon: Icon, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false) -> (index: int, ok: bool)
menu_label :: proc(label: string, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false, icon := Icon{}) -> (index: int, ok: bool)
toast :: proc(message: string, tone := Tone.Default)
tooltip :: proc(label: string)
tooltip_on :: proc(anchor: Id, label: string, side := TooltipSide.Top)
MenuItem :: struct {
label: string,
danger: bool, // drawn in the danger color (e.g. "Löschen")
disabled: bool,
separator: bool,
icon: Icon, // optional, before the label
}

One entry of a menu. A separator entry draws a line and ignores the other fields.

FieldTypeNotes
labelstring
dangerbooldrawn in the danger color (e.g. “Löschen”)
disabledbool
separatorbool
iconIconoptional, before the label

Source: kiln/menu.odin:98

TooltipSide :: enum {
Top,
Right,
}

Where a tooltip appears: above the anchor (below if there is no room) or to its right.

Values: .Top, .Right

Source: kiln/menu.odin:21

menu :: proc{menu_label, menu_icon}

A button that opens a list of entries below it. Returns the index of the clicked entry:

if i, ok := kiln.menu("Aktionen", ITEMS[:]); ok { ... }
if i, ok := kiln.menu(kiln.ICON_MORE, ITEMS[:], .Ghost); ok { ... }

An icon (or a single-character label) gives a square icon button.

Calls one of these, depending on the argument types:

  • menu_label proc(label: string, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false, icon := Icon{}) -> (index: int, ok: bool)
  • menu_icon proc(icon: Icon, items: []MenuItem, variant := ButtonVariant.Secondary, disabled := false) -> (index: int, ok: bool)

Source: kiln/menu.odin:112

context_menu :: proc(items: []MenuItem) -> (index: int, ok: bool)

Opens a list of entries at the pointer when the last item is right-clicked. Returns the index of the clicked entry:

if kiln.list_item() { ... }
if i, ok := kiln.context_menu(ITEMS[:]); ok { ... }
ArgumentTypeDefault
items[]MenuItemrequired
ReturnsType
indexint
okbool

Source: kiln/menu.odin:183

dialog :: proc(name: string, title: string) -> bool

A modal dialog with a title and a close button over a dimmed backdrop. While shown it returns true; put the body into the block. On compact screens it becomes a sheet at the bottom.

if kiln.button("Löschen", .Danger) {kiln.show("confirm")}
if kiln.dialog("confirm", "Eintrag löschen?") {
kiln.text("Das kann nicht rückgängig gemacht werden.")
if kiln.actions() {
if kiln.button("Abbrechen", .Ghost) {kiln.hide()}
if kiln.button("Löschen", .Danger) {append(out, Delete{}); kiln.hide()}
}
}
ArgumentTypeDefault
namestringrequired
titlestringrequired
ReturnsType
#0bool

Source: kiln/dialog.odin:28

drawer :: proc(name: string) -> bool

A panel that slides in from the left edge over a dimmed backdrop, e.g. the navigation on compact screens. While shown it returns true; put the content into the block.

ArgumentTypeDefault
namestringrequired
ReturnsType
#0bool

Source: kiln/dialog.odin:97

menu_icon :: proc(
icon: Icon,
items: []MenuItem,
variant := ButtonVariant.Secondary,
disabled := false,
) -> (index: int, ok: bool)
ArgumentTypeDefault
iconIconrequired
items[]MenuItemrequired
variantButtonVariantButtonVariant.Secondary
disabledboolfalse
ReturnsType
indexint
okbool

Source: kiln/menu.odin:130

menu_label :: proc(
label: string,
items: []MenuItem,
variant := ButtonVariant.Secondary,
disabled := false,
icon := Icon{},
) -> (index: int, ok: bool)
ArgumentTypeDefault
labelstringrequired
items[]MenuItemrequired
variantButtonVariantButtonVariant.Secondary
disabledboolfalse
iconIconIcon{}
ReturnsType
indexint
okbool

Source: kiln/menu.odin:117

toast :: proc(message: string, tone := Tone.Default)

Shows a short message for the theme’s toast_duration: bottom right, or at the top on compact screens (where sheets and buttons live at the bottom). Can be called from anywhere, also from update:

kiln.toast("Gespeichert", .Success)
ArgumentTypeDefault
messagestringrequired
toneToneTone.Default

Source: kiln/dialog.odin:223

tooltip :: proc(label: string)

Shows label in a bubble next to the last item after the pointer rested on it for the theme’s tooltip_delay:

kiln.button("Speichern")
kiln.tooltip("Strg+S")
ArgumentTypeDefault
labelstringrequired

Source: kiln/menu.odin:31

tooltip_on :: proc(anchor: Id, label: string, side := TooltipSide.Top)

A tooltip for any element (parts of custom widgets, chart bars, …), not only the last item. Call it every frame after declaring the element.

ArgumentTypeDefault
anchorIdrequired
labelstringrequired
sideTooltipSideTooltipSide.Top

Source: kiln/menu.odin:37