Skip to main content

Button

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)

API

ui.button(label, onPress, props?)

Props

PropTypeDescription
labelstring | reactive getterButton text. Passed as the first argument.
onPressfunction(payload)Lua callback called when the button is clicked.
variant'primary' | 'ghost'Visual style. Defaults to primary.
icon, iconComponent, startIcon, startIconComponenticonLeading icon.
endIcon, endIconComponenticonTrailing icon.
iconPosition'start' | 'end'Moves the primary icon to the end when set to end.
labelClassNamestringExtra class for the label span.
iconClassName, startIconClassName, endIconClassNamestringExtra icon slot classes.
className, stylemixedCommon LUI styling props.

Icon formats

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.