No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Set togglew color if false

    Help
    2
    3
    119
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • PeterQF
      PeterQF last edited by

      My sustomer want the toggle to be green when on (true) but red when off(false)

      I tried:

        <q-toggle
                            ref="single"
                            size="xl"
                            v-model="itemEdit.single"
                            val="1"
                            :label="$t('posts.single')"
                            :color="itemEdit.single ? 'red' : 'green'"
                          />
      

      This won’t work. Am i’m doing anything wrong or is it not posible?

      dobbel 1 Reply Last reply Reply Quote 0
      • dobbel
        dobbel @PeterQF last edited by dobbel

        @peterqf

        the color only controls the ‘when true’ color. I tried something with “keep-color” attribute:

        https://codepen.io/ontwikkelfabriek/pen/LYbPaQb

        1 Reply Last reply Reply Quote 0
        • PeterQF
          PeterQF last edited by

          @dobbel worked like a charm. Thank you so much!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post