Skip to content

Widgets

All of them follow the rules: value widgets return (new_value, changed), buttons return bool, menus (index, ok). Click a name for the full argument list.

widgetexample
texttext(s, .Caption, .Muted), text(title, ellipsis = true)
iconicon(FOLDER, .Title)
badgebadge("Neu", .Primary), badge("Online", .Success, dot = true)
avataravatar(name)
statstat("Umsatz", "1840 €", delta = "+4 %")
progressprogress(v, color = c, thin = true)
spinnerspinner()
calloutif kiln.callout(.Danger, "Fehler") { ... }
empty_stateif kiln.empty_state(title, text) { ... }
imageimage(img)
widgetexample
buttonbutton("OK"), button(kiln.ICON_MENU, .Ghost), button("Suchen", icon = kiln.ICON_SEARCH), button("Entfernen", .Ghost, tone = .Danger)
chipchip("Offen", m.open)
checkboxcheckbox(m.notify, "Benachrichtigungen")
toggletoggle(m.dark, "Dunkel")
radioradio(m.size, Size.Large, "Groß")
sliderslider(m.v, 0, 100)
text_fieldtext_field(m.s, "Name"), text_field(m.pw, "Passwort", password = true)

Choice widgets take either a slice of labels and return an index, or an enum-indexed array and return the enum.

widgetexample
tabstabs(m.tab, TAB_NAMES)
segmentedsegmented(m.range, RANGES, fill = true)
navnav(m.page, PAGES, collapsed = true)
selectselect(m.i, OPTIONS[:])
chipschips(m.i, LABELS[:])
widgetexample
date_fielddate_field(m.due, min = kiln.today())
calendarcalendar(m.day)

Plus date math: date_add_days, date_add_months, date_diff, date_parse, date_format, … see Dates.

widgetexample
tabletable(m.sel, COLUMNS[:], rows)
treetree(m.sel, nodes)
widgetexample
bar_chartbar_chart(values, labels, format = f, highlight = i)
timelinetimeline(rows, ticks)
legendlegend(items)
swatchswatch(color)

chart_color(i) gives the i-th categorical color of the theme.

widgetexample
dialogif kiln.dialog("name", "Titel") { ... }
drawerif kiln.drawer("nav") { ... }
show / hideshow("name"), hide()
menumenu(kiln.ICON_MORE, ITEMS[:])
context_menucontext_menu(ITEMS[:]) after the item
tooltiptooltip("Strg+S") after the item
toasttoast("Gespeichert", .Success)

A dialog, the way it is meant to be used:

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()}
}
}

The “Komponenten” page of the example shows every widget once:

Terminal window
odin run example -collection:lib=. -define:START_PAGE=5