GenieFramework / StippleUI.jl

StippleUI is a library of reactive UI elements for Stipple.jl.
MIT License
84 stars 15 forks source link

dynamic label #36

Closed cwiese closed 2 years ago

cwiese commented 2 years ago

I was on a roll - but this seem simple .. yet I am lost .. how can I make the btn label dynamic

this will not work label=@bind(:model_label)

card([
      card_section(
        btn_dropdown(color="primary", class="glossy q-ml-lg", label=@bind(:model_label), 
        [list( map([
            ("mails", "mail", "Mails"),
            ("alarm", "alarm", "Alarms"),
            ("photos", "photo", "Photos"),
            ("movies", "movie", "Movies"),
            ("videos", "slow_motion_video", "Videos")]) do (name, icon, label) 
                item(@click("onModelItemClick"), clickable=true, v__close__popup=true, 
                [
                    item_section([
                        item_label(label)
                    ]),
                ])
            end)
        ])
      )
hhaensel commented 2 years ago

It's just label=:model_label

cwiese commented 2 years ago

right! thanks

hhaensel commented 2 years ago

You have probably realised that your code was not yet working as expected. You would need to supply an additional empty string after item( and supply the keyword inner for the content in older Versions of Genie. The latest version would only need the empty string, and we are currently discussing a change that would even make your code working as it is written above.

list( map([
            ("mails", "mail", "Mails"),
            ("alarm", "alarm", "Alarms"),
            ("photos", "photo", "Photos"),
            ("movies", "movie", "Movies"),
            ("videos", "slow_motion_video", "Videos")]) do (name, icon, label) 
                item("", @click("onModelItemClick"), clickable=true, v__close__popup=true, 
                inner = [
                    item_section([
                        item_label(label)
                    ]),
                ])
            end)
cwiese commented 2 years ago

I was just getting back to this you probably saved me hours ! thx