Enhance Vuetify pagination with personalized styles

I'm attempting to create a toolbar with pagination control aligned to the right, featuring smaller pagination control buttons.

To achieve this, I took the following steps:

  1. Wrapped v-pagination in span (since v-spacer did not work without this)
  2. Added v-spacer
  3. Implemented custom CSS

However, even after making these changes, the pagination control is still not functioning correctly.

Below is a demonstration of the issue: while both controls are set to display 5 pages, the one with custom styling is failing to show all 5 icons.

new Vue({
    el: '#app',
    vuetify: new Vuetify(),
    data: () => ({
      pageDefault: 1,
      pageCustom: 1,
    }),
  });

Vue.config.productionTip = false
Vue.config.devtools = false
.custom .v-pagination__navigation {
  height: 26px !important;
  width: 26px !important;
}

.custom .v-pagination__navigation .v-icon {
  font-size: 16px !important;
}

.custom .v-pagination__item {
  height: 26px !important;
  min-width: 26px !important;
  font-size: 0.85rem !important;
}

.right {
  width: auto !important;
  margin-left: auto !important;
}
<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/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="99fff6f7edd9adb7e1">[email protected]</a>/css/materialdesignicons.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3e484b5b4a5758477e0c1046">[email protected]</a>/dist/vuetify.min.css" rel="stylesheet">
  
  <div id="app">
    <v-app>
      <v-content>

        <v-toolbar
          dark
          dense
        >
          <v-toolbar-title>With Default Style</v-toolbar-title>
          <v-spacer> </v-spacer>
          <span>
            <v-pagination
              v-model="pageDefault"
              :length="5"
              light
              circle
            />
          </span>
        </v-toolbar>


        <v-toolbar
          dark
          dense
        >
          <v-toolbar-title>With Custom Style</v-toolbar-title>
          <v-spacer> </v-spacer>
          <span>
            <v-pagination
              class="custom"
              v-model="pageCustom"
              :length="5"
              light
              circle
            />
          </span>
        </v-toolbar>

        <v-toolbar
          dark
          dense
        >
          <v-toolbar-title>Codeply-er suggestion</v-toolbar-title>
          <v-pagination
            class="custom right"
            v-model="pageCustom"
            :length="5"
            light
            circle
          />
        </v-toolbar>

      </v-content>
    </v-app>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0b7d7e6e4b392573">[email protected]</a>/dist/vue.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6e181b0b1a0708172e5c4016">[email protected]</a>/dist/vuetify.js"></script>

Answer №1

To achieve the desired layout, I suggest using auto for both the margin-left and width properties within the .custom class...

.custom {
    width: auto;
    margin-left: auto;
}

This approach allows you to eliminate the need for a spacer element...

<v-toolbar
      dark
      dense>
     <v-toolbar-title>With Custom Style</v-toolbar-title>
     <v-pagination
          class="custom"
          v-model="pageCustom"
          :length="5"
          light
          circle />
  </v-toolbar>

Check out the Demo

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

Can someone help me locate the selector for using .click in Nightmare.js?

I am currently using Nightmare.js to automate the scraping of a webpage. As a sysadmin, my understanding of Node.js and CSS is limited. So far, I have been able to successfully use Nightmare to input and click on certain buttons in order to log in. I iden ...

Identifying the position of an element as the first, nth, or last child within its parent using ReactJS

I'm currently experimenting with dynamic functionality in ReactJS and I need to determine the position of a child relative to its parent. How can I achieve this in ReactJS? I have come across this post which discusses detecting relationships between ...

checkbox inspired by the design of the iPhone

I'm looking to create a custom checkbox! <label id="sliderLabel"> <input type="checkbox" /> <span id="slider"> <span id="sliderOn">SELECTED</span> <span id="sliderOff">SELECT</span> ...

Arranging Bootstrap Grids within Laravel

On my current web page, I have implemented Bootstrap Grids as seen in the image below. Check out My Bootstrap Grid Layout However, I am aiming to achieve a grid layout similar to the one shown in the picture with a red indicator. Here is the Desired Boo ...

Is There a Way to Verify if JqxGrid Contains Any Errors?

Within the code below, I have successfully displayed highlighted borders when there are validation failures. Is it possible to determine any validation errors in a grid when a button is clicked? By clicking the button at the bottom, I would like to be able ...

What is the reason behind a taller button when using a single line span?

Currently experiencing some strange effects with the radio buttons I'm working on. My goal is to have them all be the same size, but they are coming out different depending on whether the text within the button spans one or two lines. I've been a ...

Making a Dialog resizable with jQuery's Resizable Helper

Is there a way to implement the Helper feature from jQuery Resizable, which only shows a frame while resizing the container, in a Dialog? ...

When using a custom selection color to highlight underlined text, the underline becomes invisible

I am currently working on a website where I want to customize the text selection color. ::selection { background-color:#00ffff; } However, there seems to be an issue in this specific situation: p::after { content:"Try selecting the above elemen ...

The alignment of the table appears off on Internet Explorer, while it is perfectly centered on all other web

I'm encountering a strange issue with my table alignment on Internet Explorer. The table is offset to the right in IE, but perfectly centered in other browsers like Edge, Firefox, and mobile browsers. I am using Bootstrap for my design, but haven&apos ...

Show product name when hovering over the image

Trying to achieve a hover effect where product titles appear in a contained box when hovering over the product image on the bottom overlay, instead of below the image itself. Tried CSS code recommended by Shopify, but it had no effect: <noscript> ...

Ensure all vertically stacked boxes maintain the same height using Flexbox technology

My design includes a series of links styled as larger boxes, with varying content and height. Using flexbox to ensure equal heights on each row is straightforward. I'm utilizing the Bootstrap grid layout, but when the boxes stack vertically (one per r ...

What is the best way to ensure a textarea element fills the entire height using Bootstrap 4?

Is there a way to ensure the textarea element dynamically adjusts its height to fill the space between the header and footer without causing a scroll bar when using bootstrap 4? Here is the HTML code snippet I've been working with: #container { ...

Is there a way to update the styling of specific sections of an input field as the user enters text in React?

Just like in most markdown editors, I am looking to enable the ability to modify parts of an input field as the user enters text. For instance: When the user types "_above_", as soon as the second underscore is typed, the text should be styled accordingly ...

Incorporate dynamic body color changes across all pages using AngularJS

On the home page, I want to change the color scheme so that it is consistent across all pages. The user should be able to choose a color from a list on the home page and have it apply to every page. Currently, the color selection only applies to the home p ...

Ways to customize the appearance of a specific column in a k-grid td

While working with a kendo grid, I encountered an issue with setting a tooltip for one of the columns. After some experimentation, I discovered that in order for the tooltip to display correctly, I needed to override the overflow property on the k-grid td ...

Place a written message on an picture

<head> <style> .relative{position:relative; width:600px;} .absolute-text{position:absolute; bottom:1; font-size:12px; font-family:"vedana"; background:rgba(251,251,251,0.5); padding:10px 20px; width:10%; text-align:center;} </style> < ...

Four-pointed star design with rounded edges

https://i.sstatic.net/E3ZFb.png My goal is to create a pixel-perfect star using CSS. I have attempted to achieve this so far, but the star currently has 5 points and I would like it to only have 4 points. Additionally, I am looking for a way to make the c ...

Ways to eliminate the margin space on a Bootstrap 4 progress bar

Currently experimenting with the Bootstrap 4 Progress component and attempting to integrate it within a sentence. Customizing its width to fit between words while realizing it is usually meant to occupy an entire row. Despite reducing its size, there seems ...

Is it necessary to use block elements when specifying image dimensions in HTML?

I have encountered a unique scenario where I want to set a pre-determined height for an HTML img element before it finishes loading. This is crucial because this height will be utilized in a calculation that may occur before the image is completely loaded, ...

Utilizing a CSS file within a YAML configuration in R Quarto

Is there a way to reference a css file from a yaml file in my R Quarto Book? The css file defines the theme for my Quarto document, and I want all our Quarto docs to have the same appearance. When I directly call the css file, I can customize aspects like ...