In order to design a v-btn-toggle with vertically aligned buttons, rather than horizontally

I'm currently in the process of developing a quiz using VueJS and Vuetify. My challenge lies in organizing the answer options vertically for the user to select. I attempted to utilize the v-btn-toggle component, but encountered an issue where the buttons are aligned horizontally by default. Is there a way to set them up vertically instead?

Here's how my layout looks:

<v-btn-toggle v-model="toggle_multiple" multiple>
    <v-btn>
         Answer 1
    </v-btn>
    <v-btn>
         Answer 2
    </v-btn>
    <v-btn>
         Answer 3
    </v-btn>
    <v-btn>
        Answer 4
    </v-btn>
</v-btn-toggle>

As suggested in this discussion, I tried styling it this way:

.v-btn-toggle{
    flex-direction: column;
}

The attempted solution resulted in an unexpected outcome, where only the first two answers were displayed partially as shown here: example image

Any assistance would be greatly appreciated.

Edit:

I've identified that the issue stems from Vuetify's preset CSS styles, particularly limiting the button height to 48 pixels with the following code:

.v-btn-group--density-default.v-btn-group {
  height: 48px;
}
This restriction is hindering me from creating button groups taller than 48 pixels. I am hesitant to alter Vuetify's defaults due to compatibility concerns. Instead, I am exploring ways to override the default CSS without success so far, as illustrated in this screenshot.

Answer №1

It was discovered by the original poster that Vuetify comes with a default height of 48 pixels.
After verifying that everything operated correctly in terms of flexbox, it was determined that the issue could be resolved by locally overriding the default values using CSS specificity.

The OP successfully targeted the specific button by using

#my-button-group {
  height: auto;
}

Alternatively, another option is to utilize

button.v-btn-group--density-default.v-btn-group
.

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

Placing an emblem after the header wording

Within my h1 tag, I have a header text that I would like to display alongside a small icon on the right side. The length of the text can vary, which presents a challenge in alignment. I attempted to use a background image with no repeat, but it ends up p ...

Exploring the dynamic duo of Google Spreadsheets and Vue

Hey there! I've been using the awesome library found at https://github.com/theoephraim/node-google-spreadsheet to interact with Google Sheets. The authentication process seems to be working fine, but when I attempt to retrieve the sheets for further ...

Matching CSS attribute values with another attribute

Can CSS be used to target elements based on the value of another attribute? For instance: <div data-attr1="abc" data-attr2="def"></div> <div data-attr1="abc" data-attr2="abc"></div> I am looking for something like this (although i ...

Vue.js - When trying to access the `use` property, it throws an error saying it is undefined

I'm encountering an issue with Vue.js 3 while trying to implement router functionality. Here is my main.js file: import { createApp } from 'vue' import App from './App.vue' import VueRouter from 'vue-router' // ad ...

Converting CSS code into JavaScript

I am currently working with the following code: .mr15 > * margin-right: 15px &:last-child margin-right: 0 I need help translating this code to Javascript. Should I use JQuery or pure Javascript for this scenario? Thank you. ...

aiplafrom struggles to establish a customer using Vite alongside Vue and TypeScript

I'm currently experimenting with Gemini Pro on Vite + Vue + TS, but I encountered an issue when attempting to create an instance of PredictionServiceClient. The error message displayed is Uncaught TypeError: Class extends value undefined is not a cons ...

What is the process for sending the selected checkbox text to an action result on a Razor page?

Working with asp.net core razor pages, I am passing the selected id as an array successfully. However, the issue arises when the selected text value for the checkbox is not being passed or displayed. The problem seems to be occurring on this line of code ...

What is the best way to create a fixed positioning for a div within a Material-UI table container?

When using the Material UI Table, I encountered an issue with applying the sticky property. The table itself works fine, but I also have a button inside the TableContainer that should be sticky alongside the table head. I attempted to achieve this by using ...

Setting the transition time for adding or removing components in ReactJS CSS

As the list component changes in size based on its children, it tends to move around abruptly. Applying transition: 'all 0.3s ease' doesn't resolve this issue since it's the layout that is affected by the number of children rather than ...

Transitioning in Vue.js when data changes

Within the Vue documentation, there is only guidance on showing or hiding elements based on a condition. But what if you want to add a transition based on a change in value? For instance, displaying an upward arrow for 3 seconds when the new value is highe ...

Several radial progress charts in JavaScript

While attempting to recreate and update this chart, I successfully created a separate chart but encountered difficulties with achieving the second progress. The secondary chart <div id="radial-progress-vha"> <div class="circle-vha ...

Changing the Div heights in Material UI with grid layout customization

I have a project that requires me to implement material-ui. Is there a way I can adjust the width and height of the div containing the "Sign In With" text (as shown in the first image) to bring the buttons closer to the text? Transformation from this: ht ...

What can be done to stop Bootstrap columns from shifting positions or stacking on top of each other unexpectedly?

I'm currently working on a testimonial section for my project. The challenge I'm facing is that the content within the 4 divs is not evenly distributed. As a result, when I try to adjust the width of the screen and expect them to align in a 2-2 f ...

Using Vue's v-bind directive with a single set of curly braces expression

Currently, I am delving into the world of Vue.js to broaden my knowledge and gain practical experience. While following a tutorial, I encountered an interesting scenario involving the addition of a class to a span element based on a condition within a v-f ...

Guide on converting this function into a computed property within Vue

Is it possible to concatenate a fixed directory path, which is defined in the data property, with a file name that is determined using v-for? I encountered an issue when attempting to do this using a computed property. The error message displayed was: ...

Enhance User Experience by Implementing Event Listeners for Changing Link Visibility Using mouseover and getElementsBy

I am new to JavaScript and struggling to find a solution. Despite searching online for fixes, none of the solutions I've found seem to work for me. I have spent hours troubleshooting the issue but I must be missing something crucial. Can someone plea ...

Illustrate an element positioned beneath a child element within a different element

I am in the process of designing an overlay on a Google Map that resembles a real map placed on a table, using 2 pixel lines as creases above the map. This design does not significantly impact interactions with the map; only 6 out of 500 vertical lines are ...

Avoiding text from overflowing a DIV when the parent DIV's width is specified as a percentage

After extensively searching through over 20 similar posts, I have not been able to find a solution that works for my specific issue. The layout of some content I'm working with resembles the example provided here: Check out the Fiddle Example In th ...

What is the reason for incorporating the footer within the container?

To see the issue in question, please visit: The footer needs to span the full width. Here is the code snippet for the page: <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <div class="container"> <div c ...

Troubleshooting Vue Single File Components Displaying Missing Styles

I'm currently attempting to incorporate styles into a vuejs single file component. I've successfully achieved this in a node app previously, but now I am working with a python/flask backend (not that it should make a difference). The Vue componen ...