Button renders an action button and routes clicks back to Lua through the registered callback.
lui.page('actions', function(ui)
ui.button('Save', function(payload)
print('saved from LUI')
end, {
iconComponent = 'lucide:save',
variant = 'primary'
})
end)
ui.button(label, onPress, props?)
| Prop | Type | Description |
|---|
label | string | reactive getter | Button text. Passed as the first argument. |
onPress | function(payload) | Lua callback called when the button is clicked. |
variant | 'primary' | 'ghost' | Visual style. Defaults to primary. |
icon, iconComponent, startIcon, startIconComponent | icon | Leading icon. |
endIcon, endIconComponent | icon | Trailing icon. |
iconPosition | 'start' | 'end' | Moves the primary icon to the end when set to end. |
labelClassName | string | Extra class for the label span. |
iconClassName, startIconClassName, endIconClassName | string | Extra icon slot classes. |
className, style | mixed | Common LUI styling props. |
ui.button('Close', onClose, {
endIcon = '->'
})
ui.button('Save', onSave, {
icon = {
name = 'lucide:save',
width = 16
}
})
motionButton uses the MotionNode renderer but keeps the same label, onPress, and icon conventions.