Skip to content

Button component only allows one child #172

@jquesada2016

Description

@jquesada2016

Take the following example:

fn main() {
    element! {
        Button {
            Text(content: "<")
            #( Some(element! { Text(content: "Click me") }) )
            Text(content: ">")
        }
    }
    .print()
}

This code will print <, rather than <Click me>.

In my case, I was trying to wrap the button component to add some default styling, and adding <...> to whatever components were passed in, but I saw in the source code the button component only gets a single next child, rather than attempting to render all children.

A workaround is to put the children in a View, but I thought it was a good idea to raise this issue. :(

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions