11

So I have a group of buttons that I'd like to be on the right side of the page, but justify-end/justify='end' is not working on v-row.

<!DOCTYPE html>
<html>

<head>
  <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/@mdi/font@3.x/css/materialdesignicons.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
</head>

<body>
  <div id="app">
    <v-app>
      <v-container>
        <v-form>
          <v-row justify='end'>
            <v-col>
              <v-btn>Button 1</v-btn>
              <v-btn>Button 1</v-btn>
              <v-btn>Button 1</v-btn>
            </v-col>
          </v-row>
        </v-form>
      </v-container>
    </v-app>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
  <script>
    new Vue({
      el: '#app',
      vuetify: new Vuetify(),
    })
  </script>
</body>

I've looked at this question, but using text align seems hacky, and I'm wondering if there is a better solution?

1
  • try putting the v-row with the justify='end' inside the v-col Sep 3, 2019 at 10:05

3 Answers 3

36

Add the text-right class to <v-col>:

<v-col class="text-right">
  <v-btn>Button 1</v-btn>
  <v-btn>Button 2</v-btn>
  <v-btn>Button 3</v-btn>
</v-col>
2
  • 1
    <v-btn :right="true" :absolute="true"></v-btn> Oct 29, 2020 at 17:08
  • @BenSummerhayes Sadly, your tip does not work for me in Vuetify 3.1.3. Feb 10 at 1:56
8

Without changing the grid system try to add <spacer/> component in order to put v-col to the end of row like :

<!DOCTYPE html>
<html>

<head>
  <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/@mdi/font@3.x/css/materialdesignicons.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
</head>

<body>
  <div id="app">
    <v-app>
      <v-container tag="div">

        <v-form>
          <v-row justify="end">
            <spacer/>
            <v-col>
              <v-btn>Button 1</v-btn>
              <v-btn>Button 1</v-btn>
              <v-btn>Button 1</v-btn>
            </v-col>
          </v-row>
        </v-form>

      </v-container>
    </v-app>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
  <script>
    new Vue({
      el: '#app',
      vuetify: new Vuetify(),
    })
  </script>
</body>

1

You have to use justify-end in a class on a v-row to get it to work. You can't use it on a v-col. DOCS: https://vuetifyjs.com/en/api/v-row/ You may need to play around with the spacing depending on where you put them but you can use the class to do that to avoid any styles.

    <v-form>
     <v-row class="justify-end">
       <v-btn class="mr-2">Button 1</v-btn>
       <v-btn class="mr-2">Button 1</v-btn>
       <v-btn class="mr-2">Button 1</v-btn>
     </v-row>
    </v-form>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.