Using Attributes

You can also define the HTML attributes for NUI components using both the designer and code

In Designer

In the designer, you can set the attributes for a component as a key: value pair with one attribute per line.

Using Code

Adding Attributes

You can use the add_attribute method

self.button_1.add_attribute("aria-label", "close")

The second argument is optional since some attributes don't require it

self.button_1.add_attribute("disabled")

Removing Attributes

You can remove attributes using the remove_attribute method

self.button_1.remove_attribute("aria-label")

Last updated