Browse documentation
Documentation

Component properties

Edit this guide on GitHub

Derives a builder that checks required properties at compile time.

For ButtonProps, the derive generates ButtonPropsBuilder. Its build() method is available only after every required property has been set.

#[derive(Props)]
struct ButtonProps {
    #[into]
    label: String,
    kind: ButtonKind,
    #[default]
    disabled: bool,
}

let props = ButtonProps::builder()
    .label("Save")
    .kind(ButtonKind::Primary)
    .build();

Field Attributes

Use field attributes to control the builder: