What is the best way to make the button cover the entire width?

I have a Vuetify card with a layout where I am rendering some dynamic Vuetify components inside the card based on checkbox selection. These components can be a divider, a spacer, toolbar, or a button. However, I'm struggling to make the buttons span the entire width.

Essentially, I want the dynamic button to take up the full width like the button at the end of the card does.

Please refer to this CodePen example: CodePen.

Please find the working example below:

new Vue({
  el: "#app",
  data() {
    return {
      pricing: [{
          text: "Actual price:",
          value: "$17,000",
        },
        {
          text: " Discount",
          value: "$12,345",
        }
      ],
      elements: [{
          title: "Divider",
          value: "v-divider"
        },
        {
          title: "Spacer",
          value: "v-spacer"
        },
        {
          title: "Toolbar",
          value: "v-toolbar"
        },
        {
          title: "Button",
          value: "v-btn"
        }
      ],
      selected: []
    };
  }
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="b4d2d1c1d0cdf2eeeceee6efacf3fee6ebe3a8e7fbf3">[email protected]</a>/dist/vuetify.min.js"></script>
<link rel="stylesheet"  href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons'>

<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6e080b1b0a17180e090918153216050a15181d">[email protected]</a>/dist/vuetify.min.css" rel="stylesheet" />

<div id="app">
  <v-app id="inspire">
    <v-container>
      <v-layout row>
        <v-flex xs6>
          <v-card>
            <v-card-text>
              <v-layout row justify-space-between v-for="option in pricing" :key="option.value" class="my-3">
                <span :class="option.class">{{option.text}}</span>
                <component v-for="(el, i) in selected" :key="i" :is="el.value"></component>
                <span>{{option.value}}</span>
              </v-layout>
              <v-layout row justify-center>
                <v-flex xs11>
                  <v-btn block>
                    Request
                  </v-btn>
                </v-flex>
              </v-layout>
            </v-card-text>
          </v-card>
          <v-flex v-for="el in elements" :key="el.value">
            <v-checkbox :value="el" v-model="selected" :label="el.title">
            </v-checkbox>
          </v-flex>
        </v-flex>
      </v-layout>
    </v-container>
  </v-app>
</div>

Any assistance would be greatly appreciated. Thank you very much.

Answer №1

To ensure buttons extend the full available width, you can use .flex.xs12 (where 12 = flex-basis: 100%;) or simply remove xs12 and add the button block attribute with flex: 1 0 auto.

<!-- By adding the block attribute to buttons, they will extend the full available width -->
<template>
  <v-btn block>
    Block Button
  </v-btn>
</template>

Visit this link for more information on creating block buttons in Vuetify

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Use flexbox to manage the width of containers and control the wrapping of elements

Hello, I am a newcomer to utilizing flexbox in CSS. I have these "boxes" that need to maintain their width and wrap when the screen size is small. On a large screen: https://i.sstatic.net/dXnGC.png On a small screen: https://i.sstatic.net/8rZso.pn ...

Display a list group in two columns using Bootstrap 4's grid system

Is there a way to create a list-group with 2 columns using bootstrap 4? <div class="categories"> <h4>Categories</h4> <ul class="list-group"> <li class="list-group-item active">Name 1</li> <li clas ...

Creating designs on the canvas

With this code snippet, I have the ability to create lines using mouse points on a canvas. My goal is to identify when these lines connect to form a shape and then fill that shape with color. <script language="javascript" src="//ajax.googleapis.com/a ...

Sending VUE-Array data to Laravel using hidden input fields

Hello everyone! This is my first time posting on a forum, so I hope you can bear with me as I navigate through the discussions. I'm still learning the ropes and it may take me a little bit to grasp everything :D I have come across an issue in my Lara ...

div positioned on top of additional div elements

My HTML code consists of simple div tags <div class="left">Project Name: </div> <div class="right">should have a name</div> <div>Shouldn't this be on a new line?</div> These classes are defined in a stylesheet as ...

Arranging elements within distinct div containers

Utilizing Bootstrap 4, I crafted a card-deck containing two cards. Despite the equal height of both cards, the alignment of elements is affected by varying text lengths. <link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min ...

Issue: $injector:unpr Angular Provider Not Recognized

I've recently developed an MVC project and encountered an issue regarding the loading of Menu Categories within the layout. <html data-ng-app="app"> . . . //menu section <li class="dropdown" ng-controller="menuCategoriesCtrl as vmCat"> ...

Unable to modify the logo images in React

I'm struggling to figure out how to make my images (favorite.svg and favorite-white.sgv) change every time the button is clicked in React. I've tried various solutions but it's proving to be quite challenging. When the button is clicked, I ...

Transfer the file image stored in a MySQL database to an excel spreadsheet

Having an issue with capturing image data input from a PHP and HTML database to Excel. I am trying to display the images in a specific size within an Excel file. Below is the PHP code used to create the table: <?php header("Content-type: application/o ...

Repeated Hover Effects on CSS Menu Icons

the webpage I need help with is (issue with general menu drop down) Hello I recently decided to enhance my menu by incorporating icons. I had successfully implemented a drop-down menu using only HTML and CSS, but when I attempted to add icons next to ea ...

Instructions on submitting a form containing multiple select lists using the enter key

After researching various threads, I have come across solutions using the JS onkeypress function to trigger actions with input fields. However, in my case, I need to implement this functionality with a form that consists of multiple select lists instead of ...

When the direction is right-to-left (rtl), the floating labels in Bootstrap slide towards the center

Seeking to implement floating labels in Hebrew using bootstrap v5.2, I encountered a challenge. When switching the direction to rtl and clicking on the input box, the label slides towards the center. Here is my code snippet: <div class="form-f ...

Customizing nested tables in your HTML email

When creating an HTML email template with nested tables for maximum email client support, the question arises about using inline styling. Should the style always be applied to the lowest level td, or is it possible to apply it to a parent table or td? For ...

Mobile devices are failing to display the logo as expected

Can anyone help me figure out why the logo is not displaying on mobile devices? I've already tried resetting my phone's network and web browser, as well as reducing the size of the logo from 100px to 80px. Despite these efforts, the logo still wo ...

The promise was made but the function was never carried out

exports.index = function(req, res) { moviedb.indexMovie().then(function(){ console.log("DATABASE VALUES READ SUCCESSFULLY"); }); }; var moviedb = module.exports = { indexMovie : function() { return new P(function(resolve, reject){ ...

VueJS encountered an error: listen EADDRNOTAVAIL, indicating that the address is not available

I am a beginner in JavaScript. Recently, I started learning about Vue.js with Vue-CLI 2. However, now I want to upgrade to the latest version of Vue-CLI, which is 4.3.0. I followed a step-by-step tutorial to install it, but when I try to run npm run serve, ...

Load content within the DIV container

I need help finding code that can use JQuery to load a page into a DIV element. Essentially, I want to load displaycatch.php into a specific DIV <div id="results">Content for id "results" Goes Here</div> Furthermore, I would like to add a ...

What exactly is the functionality of the third parameter (usually next()) behind the scenes in ExpressJS once it is hidden behind the abstraction layer?

Consider this scenario: in the following two code snippets, how is the next() function used as a parameter and how does it facilitate the automatic transition to the next middleware function? What is the underlying mechanism that enables this abstraction? ...

How can I apply various textures in three.js?

Hello there! I'm diving into the world of threejs and currently working on a block game similar to Minecraft. Instead of relying solely on objects, I've decided to build my program using planes (specifically the PlaneGeometry class). As I wrap ...

I'm unsure how to utilize the generic type in this particular scenario. It's a bit confusing to me

Recently, I delved into TypeScript generics and applied them in specific scenarios. However, I encountered some challenges. While working with two different interfaces, I faced a need for flexibility. For instance, I needed to make server requests. func ...