Tuix provides inline styles which directly affect an element and cannot be overrriden by shared styles (which includes from CSS).
There are two ways to set an inline style property:
-
By calling
set_property_name(value)
on thebuilder
argument of the closure when building a widget. For example, setting the width and height of widget during building:let my_button = Button::new().build(state, parent, |builder| { builder .set_width(Units::Pixels(200.0)) .set_height(Units::Pixels(200.0)) });
-
By calling
set_property_name(state, value)
on the entity id of a widget. For example:let my_button = Button::new().build(state, parent, |builder| builder); my_button .set_width(state, Units::Pixels(200.0)) .set_height(state, Units::Pixels(200.0));
In this case
state
must be passed to the property setting functions.