Skip to main content

DeriveElement

Derive Macro DeriveElement 

Source
#[derive(DeriveElement)]
{
    // Attributes available to this derive:
    #[element]
}
Expand description

Derive Node, ContainerNode, and Element traits for an element type.

Use this for element node types that can have children, attributes, and element-specific data.

§Attributes

  • tag = "..."(required) the HTML tag name
  • focusable — mark the element as focusable by default
  • data = TypeName — the element-specific data type (default: ())

§Example

#[derive(Copy, Clone, Element)]
#[element(tag = "button", focusable, data = ButtonData)]
pub struct Button(Handle);