Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
photino opened this issue Apr 27, 2024 · 0 comments
Open

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

photino opened this issue Apr 27, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@photino
Copy link
Contributor

photino commented Apr 27, 2024

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,
}
@ealmloff ealmloff added the enhancement New feature or request label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants