Home / Lua API Manual / types / lua_widget
< dt_lighttable_layout_t
lua_container >

# lua_widget

`dt_type`

Common parent type for all lua-handled widgets

Attributes:

- has_tostring

# 🔗lua_widget.extra registration parameters

This widget has no extra registration parameters

# 🔗lua_widget.name

Lua API 6.2.0

`string or nil`

Name assigned to the widget for CSS styling purposes.

Attributes:

- write

# 🔗lua_widget.sensitive

`boolean`

Set if the widget is enabled/disabled

Attributes:

- write

# 🔗lua_widget.tooltip

`string or nil`

Tooltip to display for the widget

Attributes:

- write

# 🔗lua_widget.reset_callback

    function(
      widget : types.lua_widget
    )

A function to call when the widget needs to reset itself. Note that some widgets have a default implementation that can be overridden, (containers in particular will recursively reset their children). If you replace that default implementation you need to reimplement that functionality or call the original function within your callback.

Attributes:

- write

- widget - types.lua_widget - The widget that triggered the callback

# 🔗lua_widget.As a function

    function(
      attributes : table
    ) : types.lua_widget

Using a lua widget as a function Allows to set multiple attributes of that widget at once. This is mainly used to create UI elements in a more readable way.

For example:

    local widget = dt.new_widget("button"){
      label ="my label",
      clicked_callback = function() print "hello world" end
    }

- attributes - table - A table of attributes => value to set
- return - types.lua_widget - The object called itself, to allow chaining

< dt_lighttable_layout_t
lua_container >