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

    q-select change q-chips bg and text color when multiple is used.

    Help
    3
    12
    2341
    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.
    • F
      Fedack last edited by

      I have the following:

      <q-select
                        label="AND"
                        square
                        v-model="element.AND"
                        use-input
                        use-chips
                        multiple
                        autofocus
                        borderless
                        hide-dropdown-icon
                        input-debounce="0"
                        new-value-mode="add-unique"
                        hint="All must be true."
                        color="accent"
                        dark
                      />
      

      And I want to be able to change the color of the chips inside. How would I go about this? I can find in the documentation that there’s a way to add a scoped props for the q-chips but it’s not clear on how to make it work with a simple array like [‘one’,‘two’,‘three’].

      1 Reply Last reply Reply Quote 0
      • s.molinari
        s.molinari last edited by s.molinari

        Yes. You can use either the selected or the selected-item slots.

        https://codepen.io/smolinari/pen/ExxRaeW

        The docs, which you probably already read: https://quasar.dev/vue-components/select#Example--Selected-item-slot

        Are you wanting different colors for each chip? Or the same color? For the same color, you can use the selected slot. I noticed though, you wanted to add values in your example code and have multiple selections, then the selected-item slot is necessary. Also, if you want different colors, use the selected-item slot and it would be better when your options are an array of objects, and you also should have an array of objects in your model, as the docs suggest. I didn’t go that far with my example, as I wasn’t sure of your use case.

        Scott

        1 Reply Last reply Reply Quote 0
        • F
          Fedack last edited by

          @s-molinari Thanks a lot, it works!
          And what if I wanted to change the color of the q-select input text and it’s non-active color (like the color of the label when it’s not selected?)

          1 Reply Last reply Reply Quote 0
          • s.molinari
            s.molinari last edited by s.molinari

            You mean like this? https://codepen.io/smolinari/pen/ExxRaeW (first example)

            Scott

            1 Reply Last reply Reply Quote 0
            • F
              Fedack last edited by

              Well, that’s one problem solved. But I mean what’s been outlined in blue:
              https://files.themansion.top/f/3b43facae9354823acef/

              Basically the label.

              metalsadman 1 Reply Last reply Reply Quote 0
              • s.molinari
                s.molinari last edited by s.molinari

                The first example is a simple selection/ css change. The second is dynamic (click into the input).

                https://codepen.io/smolinari/pen/ExxRaeW

                Scott

                1 Reply Last reply Reply Quote 0
                • metalsadman
                  metalsadman @Fedack last edited by metalsadman

                  @Fedack take time to read vue docs too
                  https://vuejs.org/v2/guide/class-and-style.html

                  1 Reply Last reply Reply Quote 0
                  • F
                    Fedack last edited by

                    @s-molinari Thanks. So yeah, there’s no way to change it via simple prop. It would be good to add a prop called label-color or something like that. But this answers my questions. 🙂

                    1 Reply Last reply Reply Quote 0
                    • s.molinari
                      s.molinari last edited by s.molinari

                      Well, the whole component works off of the color prop. 😁

                      Scott

                      1 Reply Last reply Reply Quote 0
                      • F
                        Fedack last edited by

                        @s-molinari But isn’t that only when it’s focused? It’d be nice to have a prop to have it to change the color when it’s not or change the default color for dark and non-dark.

                        1 Reply Last reply Reply Quote 0
                        • s.molinari
                          s.molinari last edited by

                          Imagine every conceivable possibility to do things differently with QSelect. And, QSelect already has 15 different styling props and 72 props in total. So yeah… CSS and the class and style props are your friends. Oh, and component composition too. 😉 😃

                          Scott

                          1 Reply Last reply Reply Quote 0
                          • F
                            Fedack last edited by

                            Oh, I completely agree, you can’t cover every bases. But this is the first thing you see, it’s the main label color. I do think it should be easy to modify using props since you can change the color of the focus, why not change the color of the unfocused one? But anyways, just a suggestion. @s-molinari
                            Thank you for your time 🙂

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