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] Quasar way to align a q-btn to the middle of a div in a template?

    Help
    3
    8
    1915
    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
      murrah last edited by murrah

      I have a q-table with a <template v-slot:bottom> into which I would like to center a button. I have tried all sorts of combinations of alignment but cannot get it to work.
      eg:

      <q-table
        etc >
        <template v-slot:bottom>
          <div class="relative-position">
            <q-btn
              class="center"
              round
              icon="add"
              @click="addMyThing"/>
          </div>
        </template>
      </q-table>
      

      How to do that?
      Thanks again,
      Murray

      beets 1 Reply Last reply Reply Quote 0
      • beets
        beets @murrah last edited by

        @murrah Try:

        <q-table
          etc >
          <template v-slot:bottom>
            <div class="row justify-center">
              <div class="col-auto">
                <q-btn
                  round
                  icon="add"
                  @click="addMyThing"/>
              </div>
            </div>
          </template>
        </q-table>
        
        1 Reply Last reply Reply Quote 0
        • beets
          beets last edited by

          You could also probably do:

          <q-table
            etc >
            <template v-slot:bottom>
              <div class="text-center">
                <q-btn
                  round
                  icon="add"
                  class="inline-block"
                  @click="addMyThing"/>
              </div>
            </template>
          </q-table>
          

          I haven’t tested either version, but one of them should work.

          1 Reply Last reply Reply Quote 0
          • I
            Ilia last edited by

            class=“row justify-center” (as per example above) or class=“flex flex-center” if the div has fixed height (like 100px, 100vh, etc.)

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

              Thanks for your replies. They all work in straight divs but when in a table v-slot:bottom template they dont’!

              Codepen: https://codepen.io/flowt-au/pen/OJRpmWw?editors=1010

              The first 3 are within the table and the last 3 that are centered are outside the table.

              Weird.

              I 2 Replies Last reply Reply Quote 0
              • I
                Ilia @murrah last edited by

                This post is deleted!
                1 Reply Last reply Reply Quote 0
                • I
                  Ilia @murrah last edited by

                  @murrah Sorry, previous message is not applicable there 🙂 full-width is the key to win over that <template>

                             <template v-slot:bottom>
                                <div class="full-width row justify-center">
                                  <q-btn
                                    round
                                    icon="add"
                                    @click="addTimeZones"/>
                                </div>
                              </template>
                  1 Reply Last reply Reply Quote 0
                  • M
                    murrah last edited by

                    Yay!! That’s better!. Thank you. Very much appreciated. 🙂

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