Skip to content

Multiple class tags on component fails to compile #5082

@timh-scout

Description

@timh-scout

Problem

Using multiple class tags on a component in RSX does not work.

Steps To Reproduce

Steps to reproduce the behavior:

#[component]
pub fn ExampleComponent() -> Element {
    rsx! {
        div {
            id: "example-component",
    
            div {
                class: "text-2xl",
                class: "border-white",  // Works as expected
                "test"
            }
            Link {
                class: "flex items-center border-b",
                class: "border-white",  // Won't compile
                to: Route::ToSomeRoute {},
                "Link"
            }
        }
    }
}

Expected behavior

I expect that both html tags and components can be styled with multiple class tags for conditional styling with something like TailwindCSS

Screenshots

N/A

Environment:

  • Dioxus version: 0.7.2
  • Rust version: 1.91.1
  • OS info: Windows
  • App platform: web

Questionnaire

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions