dioxus icon indicating copy to clipboard operation
dioxus copied to clipboard

Call `.into()` automatically for the default value when deriving `Props`

Open photino opened this issue 1 year ago • 0 comments

When using #[props(into, default = "...")], we should call .into() automatically for the default value. It will be more conveninent.

#[derive(Clone, PartialEq, Props)]
pub struct FormFieldContainerProps {
    /// The class attribute for the component.
    #[props(into, default = "field is-horizontal".into())]
    pub class: Class,
    /// A class to apply to the field label container.
    #[props(into, default = "field-label".into())]
    pub field_label_class: Class,
    /// A class to apply to the field body container.
    #[props(into, default = "field-body".into())]
    pub field_body_class: Class,
    /// A class to apply to the `label` element.
    #[props(into, default = "label".into())]
    pub label_class: Class,
    /// The label content.
    #[props(into)]
    pub label: SharedString,
    /// The children to render within the component.
    children: Element,
}

photino avatar Apr 27 '24 06:04 photino