Adjust the width of the dropdown menu for the v-combobox

I am currently working on creating a multiple search filter similar to the one found in Gitlab dashboard.

https://i.sstatic.net/YHivl.png

For this task, I am utilizing Vuetify's v-combobox like this :


    <v-combobox
        id="mycombo"
        v-model="model"
        :items="items"
        multiple
        small-chips
    >
        <template v-slot:item="{ index, item }" >     
            <v-icon>
                {{item.icon}}
            </v-icon>
            <span>
                {{ item.text }}
            </span>                 
        </template>
    </v-combobox>

The main issue I am facing is adjusting the width of the dropdown. Upon inspecting in the browser, I notice certain element styles :


    <div class="v-menu__content theme--light menuable__content__active v-autocomplete__content" style="max-height: 304px; min-width: 1543px; top: 193px; left: 308px; transform-origin: left top; z-index: 8;">

By directly modifying the min-width parameter in the inspector, I am able to successfully alter the dropdown width.

My question is how can I achieve the same result in code (preferably using scoped CSS) ?

I have attempted :

  • Adding a class to a template v-slot:item -> not possible
  • Changing the style of v-autocomplete content since v-combobox is a child of v-autocomplete :

    .v-menu__content .menuable__content__active .v-autocomplete__content {
        min-width: 250px !important;
    }

  • I have heard about deep styling but could not grasp how to apply it in this scenario

What is the typical process for styling a vue component ?

Thank you for taking the time to read, have a great day everyone!

Answer №1

To customize the styles, you have the option to use :menu-props:

 <v-dropdown
     id="mydropdown"
     v-model="selectedItem"
     :options="dropdownOptions"
     multiple
     small-size
     :menu-props="{ width: '300', maxHeight: '500' }"
 >
   <template v-slot:item="{ idx, value }">
     <v-icon>
       {{ value.icon }}
     </v-icon>
     <span>
        {{ value.text }}
     </span>
   </template>
 </v-dropdown>

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

Exploring the intricacies of binding to object properties within a component

I am currently working on creating a customizable Vue.js checklist component: It will be implemented as follows: <check-list :items="myItems" text-property="name" /> Component Definition: <template> <div class="form-control item-contai ...

Dynamic SVG positioning

Looking for a way to make this svg shape relative to its containing div? Fiddle: http://jsfiddle.net/8421w8hc/20/ <div> <svg viewBox="0 0 1000 2112" style="" xmlns="http://www.w3.org/2000/svg" version="1.1"> <path id="ma" st ...

Using specific delimiters in Vue.js components when integrating with Django and Vue-loader

While working on my Django + Vue.js v3 app, I came across a helpful tool called vue3-sfc-loader. This allows me to easily render .vue files using Django, giving me the best of both worlds. The current setup allows Django to successfully render the .vue fil ...

What specific CSS selector should be targeted in order to modify the appearance of this button?

I'm attempting to alter the appearance of a button within my Wordpress site, but I've hit a roadblock in identifying the correct element to modify. So far, I've tried targeting: .input#chained-quiz-action-1, however, the button stubbornly re ...

Personalize the styling of Material UI Tables - final element customization

I've been attempting to adjust the padding of the Material UI Table. The last-child element is receiving a 24px padding which I'm trying to modify. Despite my attempts at overriding the theme and using classes{{root: classes.xxx}}, I haven't ...

Why do I keep encountering invalid errors with Vuelidate and TailwindCSS?

I am struggling to comprehend why I keep encountering validation errors. The logic seems fine, so it must be something wrong with my :class bindings. Even though I know I will feel foolish once I figure it out, I have gone through numerous tutorials and st ...

What are the steps for creating personalized sliders with WordPress?

Seeking guidance on how to code WP Template files to enable control from the WP dashboard for adding or removing slider images. A sample code snippet is provided below. <div id="myCarousel" class="carousel slide" data-ride="carousel"> <!-- Indi ...

Encountering the 'currently unable to handle this request' issue while trying to render an inertia component in Laravel 8 with vue.js

Encountering an error message that says "currently unable to handle this request" while trying to render an inertia component from app/Exceptions/Handler.php in Laravel 8. Software Versions: @inertiajs/vue2 version: 1.0.3 @inertiajs/inertia-laravel versi ...

Looking to update the location of an element within a canvas using Vue and socket.io?

I am currently developing a 2D pong game using vue.js and socket.io. At the moment, I have a black rectangle displayed in a canvas. My goal is to make this rectangle move following the cursor of my mouse. The issue I am facing is that although my console l ...

Grid layout with card tiles similar to Google Plus

I'm looking to develop a scrolling grid with card tiles similar to Google Plus that has three columns. I am currently using Material UI, but I can't seem to find the right functionality for this. I have experimented with the standard Material UI ...

Mastering the Art of Incorporating jQuery, JavaScript and CSS References into Bootstrap with ASP.NET WebForms

Hey there, I'm currently working on a personal project as a beginner in Bootstrap. My main challenge for the past two days has been trying to integrate a dateTimePicker and number Incrementer using Bootstrap techniques. Despite my efforts in researchi ...

Adjust the background color of a cell depending on its value - Implementing with VueJs and Vuetify

I am currently extracting data from a JSON file. My goal is to change the cell color to green if the value is "OK" and to red if the value is "KO". Currently, I have implemented a v-simple-table as shown below: <td :class="OK? 'primary' : &apo ...

Ways to identify when a React child element is overflowing

tl;dr How can I create a component that hides overflow and toggles views with a button? For example, the user can initially see tabs 1, 2, and 3 while tabs 4, 5, and 6 are hidden. Clicking a button will hide tabs 1, 2, and 3, and show tabs 4, 5, and 6 with ...

Personalized HTML selection list

When a select option is too long, it stretches the container to accommodate its length. I have created a truncate function to limit the display to 20 characters and add ellipses to prevent this stretching. I have been searching for a way to show the entir ...

What is the best way to display both an employee's name and ID on a single line using CSS and HTML?

I am currently working on an asp.net MVC app and facing an issue with adding employee ID and employee name on the same line, similar to the web design provided. I need to make modifications using HTML and CSS to achieve this. The problem is that I am unab ...

Tips for positioning the overlay to match the icon list when hovering- JavaScript/Cascading Style Sheets (CSS)

My challenge involves a list of <li>'s accompanied by an icon that, when hovered over, displays an overlay containing information about the 'test'. The setup looks something like this: test1 test2 test3 and so forth.... Here' ...

Refreshing a page will disable dark mode

I'm in the process of implementing a dark mode for my website using the code below. However, I've encountered an issue where the dark mode resets when refreshing the page or navigating to a new page. I've heard about a feature called localst ...

What is the best way to manipulate the canvas "camera" in HTML?

I am currently developing a 3D game that involves navigating through skyboxes. My goal is to have the camera respond to user input, specifically detecting key presses (using WASD controls) to move the camera accordingly. Do you have any suggestions on how ...

CSS HTML parent div cannot contain image properly

Creating a website using Bootstrap: <div class="row padding_zero"> <div class="col section px-0"> <img class="img-trans padding_zero" src="./svg/clouds-00.svg" style="margin-top: -150px& ...

Tips on increasing the width of the 'select' option once the user decides to make a selection

Here's a question for you: I have a <select> box where I set the width to 120px: <select style="width: 120px"> <option>REALLY LONG TEXT, REALLY LONG TEXT, REALLY LONG TEXT</option> <option>ABC</option> < ...