Round all buttons in Vuetify design

I am currently working on a vuetify application that has a multitude of buttons, and I am looking to change them all to have a rounded style without having to individually add the property to each one. Is there a way to achieve this using themes or presets?

Adding the following style works:

.v-btn{
        border-radius:28px!important;
    }

However, this approach limits my ability to use normal buttons in the future.

Creating a custom component like my-rounded-button is also an option. However, if I want to set properties globally for other components, I would need to create a custom component for every element in vuetify. Additionally, if I decide to change all buttons in the middle of the project, I would still need to modify all button names from v-btn to my-rounded-button.

My goal is to have the rounded property automatically set to true for all v-btn components, with the option to toggle it off by setting :rounded="false" when necessary.

Answer №1

After attempting to establish a default prop using presets, it was discovered that this method does not work for all components, such as buttons. Therefore, the suggestion is to define a global CSS rule:

.v-btn{
    border-radius:28px!important;
} 

Additionally, when wanting to use a normal button, another CSS rule can be added:

.v-btn-not-rounded{
    border-radius:4px!important;
} 

Then, utilize class binding like so:

<v-btn depressed :class={'v-btn-not-rounded':true} color="primary">not rounded</v-btn>

For further reference, please refer to this codepen.

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

Bootstrap-vue is designed to seamlessly integrate with Vue.js, however, it seems to be experiencing some issues

click here for image description There is an error: Uncaught TypeError: Cannot read property 'prototype' of undefined at eval (config.js?228e:6) at Module../node_modules/bootstrap-vue/esm/utils/config.js (chunk-vendors.js:6778) at webpack_requir ...

The link appears to be broken when trying to access the notFound component in Next.js version 13

In my Next.js 13.4 app directory, I added a not-found.tsx component that functions correctly when entering the wrong route: import Link from 'next/link' function NotFound() { return ( <section> 404, page not found ...

Error in Compiling HTML Elements Collection<<Element>

Currently, I am developing an eCommerce application that features a popup window for users when they click on "Add to Cart." This popup allows users to select product variations and quantities before adding the item to their cart. The popup consists of a s ...

HTML automatically removes added elements

I have embarked on the journey of developing a task management application. The main functionality I am working on involves appending a new event card to the events div when the submit button of the formlayer is clicked. function reveal() { document.g ...

Refresh the information on the page by loading data from the log file using AJAX

I am currently running a shell script in the background and directing the output to a log file using PHP. I'd like to showcase the content of this log file on the webpage, which I've managed to achieve with the following code snippet. <?php ...

Implement the parent jQuery library within a child iframe

I have a query regarding the use of two iframes in my HTML page. I am trying to implement a single jQuery file that is loaded on the parent page. The code snippet provided below works perfectly on all browsers, except for one issue with Chrome when using t ...

Guide on incorporating a Vue component into multiple components and leveraging a method to invoke it

Do you have a Vue Component called AlertSimple that displays alerts? Are you looking to make this component automatically available in all components and call it with a simple method like this: this.$alertSimple.show( 'Alert Title', 'Alert m ...

What precautions can I take to safely and securely extend event handling?

I am currently developing a small JavaScript library that includes components requiring "messages" based on specific page events, which allow users to define response functions. I need to access general events like onkeydown and let users determine how eac ...

Need to update various form fields at once with jquery?

There is a form with fields for firstname, lastname, email, country, along with edit icon and submit/cancel buttons. When the user clicks on the edit icon in the top right corner, all values will be displayed in textboxes and the country will be shown in ...

Using Vue.js - Passing a prop into $.each() within the mounted lifecycle hook

When my component is mounted, I am looking to iterate over an object literal. However, I am encountering difficulties in accessing the prop data within my .each() function. Upon checking with console.log, the prop data appears 'undefined' inside ...

Get rid of the ad wrapper that prompts users to disable their adblocker on the news page

Everyday, I visit the Norwegian news site "www.vg.no" to catch up on the latest news. However, one day while browsing on my school computer with adblock installed, I noticed that the ads were removed but an ad wrapper appeared asking to turn off adblock. B ...

Generate a dynamic key object in Angular/TypeScript

I am working with an object called "config" and an id named "id". My goal is to create an array of objects structured like this: [ "id" : { "config1: ... "config2: ... "config3: ... } "id2" : { "config ...

Seeking clarification on the distinction between using an input of type button versus an input of type submit when triggering a jQuery form submission

This particular code is designed to execute the following actions upon being clicked: Submit the form Disable the button in order to prevent double clicks Add a spinner to the button to indicate to the user that something is happening If the form is inva ...

Using conditional statements in a forEach iteration

Looking to Apply a Unique Function to a Specific Object in an Array In my current project, I have set up a forEach loop to iterate through various records from a database. Each record generates a 'panel' on the interface. Preview of the panels: ...

Is there a way to position the tooltip above the sorter icon in Ant Design (antd) component?

I'm currently working on creating a table with sorter columns using the antd framework. Can anyone guide me on how to position the tooltip above the sorter icon? Below is a snippet of my UI. https://i.sstatic.net/fGoqA.png Specifically, I included t ...

Send an ArrayList to jQuery Flot

Good day. Apologies for any language barriers as English is not my first language. I am a novice in [see tags] and I have a web application that gathers a date and a serial number to execute a SQL query. The query returns some data (measurement values an ...

Using Puppeteer to tally the instances of a particular text on a website: A step-by-step guide

Currently, I am employing NodeJS along with Puppeteer library to load a website and then verify if a particular text is visible on the page. My objective is to track the number of times this specific text appears. Essentially, I want this search to mirror ...

What method is recommended for saving data in an HTML data attribute?

Is there a way to store multiple values in an HTML data-attribute and retrieve them using jQuery? When storing values, is it best to use comma-separated or space-separated values? If I need to find <li> tags with "Mango" in the data-fruit attribute ...

Is it feasible to place an ordered list within a table row <tr>?

Below is a code snippet demonstrating how to create an ordered list using JavaScript: Here is the JavaScript code: <script type="text/javascript"> $(document).ready(function() { $("ul").each(function() { $(this).find("li").each(functio ...

Provide a unique <li> attribute for the JavaScript function to utilize

Is there a way to pass specific attributes from dropdown options to a javascript function? I have tried using .data() and .attr(), but the console keeps showing "undefined". Any suggestions on how to achieve this in a cleaner and simpler way would be gre ...