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 with input and large option label

    Framework
    3
    7
    3646
    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.
    • labs20
      labs20 last edited by

      Hi. Is there an option to apply some kind of ellipsis to a selected label option in q-select?

      When you have a label too wide for the select view, the span wraps and breaks the layout:

      Captura de Tela 2020-07-06 às 13.59.56.png

      The extra white line, caused by the search input being pushed away by the label is also bad.

      Is there a property so I can change this behaviour?

      Thanks.

      1 Reply Last reply Reply Quote 0
      • T
        turigeza last edited by turigeza

        @labs20 I know it’s not a solution you are asking for but why not go single column layout at this screen width ? It would be nicer looking and you could still see what is selected.

        If you still prefer the ellipsis instead check out this pen.
        https://codepen.io/turigeza/pen/oNbqeMb?editors=1010

        <q-select v-model="model" :options="options" label="Standard">
          <template v-slot:selected-item="scope">
            <div class="ellipsis">{{scope.opt}}</div>
          </template>
        </q-select>
        
        1 Reply Last reply Reply Quote 0
        • labs20
          labs20 last edited by labs20

          Hi! Thanks for your answer.

          Yes, you know. Every project has its own quirks, and just happens that this is the minimum size before it turns in one comp per line, so… 🙂

          Anyway, thanks for the slot suggestion. I’ll try it, but I think this would do better as a native prop.

          Thanks.

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

            can also do with css class

            .selectedText
              .q-field__native span
                white-space: nowrap
                overflow: hidden
                text-overflow: ellipsis
            

            maybe post a feature request for something like selected-class/style. so can just do something like selected-class="ellipsis".

            labs20 1 Reply Last reply Reply Quote 1
            • labs20
              labs20 @metalsadman last edited by labs20

              @metalsadman Thanks for the tip.

              It works well, but the use-input prop makes that the input keeps present even after the comp lost focus, and a blank “line” ends up added to the component area, breaking the layout.

              Captura de Tela 2020-07-07 às 15.40.05.png

              This combo of props kinda deals with the problem:

                      use-input
                      fill-input
                      hide-selected
              
              metalsadman 1 Reply Last reply Reply Quote -1
              • metalsadman
                metalsadman @labs20 last edited by metalsadman

                @labs20 well, you could’ve mentioned that in the beginning (a snippet or a codepen preferably), could’ve just use input-class="ellipsis" which is already in the api .

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

                  Well, in my first post it is clear that I was having a problem with the “new line” produced by the input.

                  I’ve readed the input-class description and it was not that obvious for me that it was the solution. I’ll try it later but I suspect that it alone will not do it.

                  Thanks anyway.

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