pencere

Components / Controls

u:button

A button: its words, an icon before them, a tone, the keys that do the same, the tip's words, a label for a screen reader where the words do not say it, and disabled.

A button: its words, an icon before them, a tone, the keys that do the same, the tip's words, a label for a screen reader where the words do not say it, and disabled. A button: its words, an icon before them, a tone, the keys that do the same, the tip's words, a label for a screen reader where the words do not say it, and disabled.

The code

return pencere.div():row():items_center():gap(8)
	:child(u:button("save", { title = "Save", tone = "primary", keys = "cmd+s" }))
	:child(u:button("revert", { title = "Revert", icon = "chevron_left" }))
	:child(u:button("delete", { title = "Delete", tone = "danger" }))
	:child(u:button("busy", { title = "Disabled", disabled = true }))

What it does

A button: its words (title), an icon before them, a tone ("neutral", "primary" for what a person most likely does, "danger" for what cannot be taken back), the keys that do the same (keys, said in its tip), the tip's words, a label for a screen reader where the words do not say it, and disabled. Pressed with the pointer, or with enter or the space bar while it has the keyboard: { kind = "press" }.

kit/sandbox/library/ui/basic.luau, line 48

Its icon

An icon that a component or one of its items takes is an element the page made, a path of the page's own bundle ("icons/save.svg": an SVG or a PNG, tinted in the colour the component draws it in), or the name of one of the library's glyphs: check, chevron_down, chevron_left, chevron_right, chevron_up, close, dash, dot, info, plus, warning.