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

    [Solved] How to get q-btns with same width

    Help
    2
    3
    2229
    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.
    • M
      Mickey58 last edited by Mickey58

      I have a simple question for which I did not find an answer in the docs or the forum:

      If I have two q-btns positioned vertically within one column, like:

                  <div class="col-2">
                    <q-btn
                      label="Short label text"
                    />
                    <br />
                    <br />
                    <q-btn
                      label="Looooooong label text"
                    />
                  </div>
      

      How can I achieve that those two buttons get the same width (either that both have the same, fixed width, preferably large enough to fit the longer label text on button 2, or both stretch out to the full column width)?

      I found in older Quasar docs that an early version of Quasar supported a “stretch” prop for q-btn, but I don’t find that in the current API docs.

      N 1 Reply Last reply Reply Quote 0
      • N
        nobilik @Mickey58 last edited by

        @Mickey58 Hi! Just use style with % width

         <div class="row">
        
              <div class="col-md-2">
                <q-btn
                  style="width: 100%;"
                  label="Short label text"
                />
                <br />
                <br />
                <q-btn
                  style="width: 100%;"
                  label="Looooooong label text"
                />
              </div>
            </div>
        

        But don’t forget div with row class wrapper outside. Also for mobile is better to use col-xs-12 instead col-md-2

        1 Reply Last reply Reply Quote 0
        • M
          Mickey58 last edited by

          Wow! I was not aware of this width: x% parameter. It is not used widely in the docs. Thanks!

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