Can you provide tips on leveraging CSS as a prop for a Vuetify v-tab component?

Currently, I am in the process of updating my website to simplify color palette swapping. We are still experimenting with different colors that work well together. Our stack includes Vue and Vuetify, with SCSS generating our primary CSS file. Most of our components are built using Vue SFCs. However, I have encountered a puzzling problem with a V-Tab, where the color of the "active" bar underneath refuses to change.

The main challenge lies in the fact that when working with Vuetify components, inline CSS has minimal impact. Passing color="#ffffff" as a prop functions perfectly, everything looks good. Unfortunately, I have been unable to achieve the same results using CSS (the generated code places the bar in a separate div element outside of the tab).

  • I have attempted various methods to override the style of the v-tabs-slider-wrapper element
  • I have experimented with utilizing SCSS functions within the computed section of the SFC
  • I have tried conventional CSS and SCSS approaches
  • I have explored binding the color attribute with a computed function referencing the SCSS function
  • I have tested using classes, ids, and names
  • I even tried using background-color in numerous ways

If anyone can offer assistance or guidance, it would be greatly appreciated.

<template>
  <v-tabs class="tabs">
    <v-tab>Thing</v-tab>
    <v-tab-item>Inner Thing</v-tab-item>
  </v-tabs>
</template>

<script>
export default { };
</script>

<style lang="scss" scoped>
@import "../styles/main.scss";

.tabs div {// this was the only way to get the tab **text** to change, doesn't work for the slider bar
  color: getColor_fromText("color"); //defined in main.scss
}
</style>

Answer №1

Have you experimented with changing the color property of the slider?

  <v-tabs-slider color="yellow"></v-tabs-slider>

For example, check out this link: https://vuetifyjs.com/en/components/tabs/#custom-icons

If you're looking to modify the background color of a specific tab, consider trying something like this:

  <v-tabs
    :background-color="activeTab === highlightTab ? 'deep-purple accent-4' : ''"
    v-model="activeTab"
  >

View the complete example (click on the second tab): https://codepen.io/DomHaas/pen/qBZrZVy

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

Testing a Vuetify Data Table using Jest for unit testing

I've developed a Vue.js application utilizing Vuetify and I'm currently working on unit testing a component that contains a Vuetify Data Table. The issue arises when trying to populate the table in my unit test, where Axios is mocked with Jest. ...

Incorporating orientation settings within a media query using MUI

In my current project, I am utilizing MUI in conjunction with React. To specifically style the iPad resolution using MUI breakpoints, I have implemented the following code snippet: contentBox:{ width:"10%", paddingLeft:"10p ...

Is it possible to incorporate a 960 grid system into a div container?

Can I contain an entire 960 grid within a div on my webpage? I am looking to create a page wider than 960px, and considering placing sidebars outside of the 960 grid while having it manage the central column. ...

Is it possible to customize the color of an SVG image within Next.js using next/image?

import Image from 'next/image' ... <Image src="/emotion.svg" alt="emtion" width={50} height={50} /> I am trying to change the color of the SVG using next/image. However, applying the following CSS rule does not seem ...

Creating a unique card component with React and custom Tailwind CSS styling

I am working on creating a project component using React: Despite my efforts, I have not been able to find the correct documentation for assistance. Additionally, I am facing challenges in utilizing next/image to ensure that it is the correct size. This ...

The functionality of classes containing <ul> elements is ineffective

Having recently embarked on the journey of learning html/css, I've encountered some confusion along the way. Allow me to showcase my basic web-page layout: <html> <head> <meta charset="utf-8"> <link rel = "stylesheet" type="text ...

Manipulating a prop class from a child component in Vue

I am still in the process of learning Vue and there is something I am struggling with. I have a component called WS.vue that assigns a class to a div (active) when a checkbox is clicked. Currently, the click event works fine and changes the class for each ...

Is there a more efficient way to implement class binding in Vue?

Seeking advice regarding a component with dynamic classes that appears cluttered. Struggling to determine if there's a more efficient way to streamline the code, particularly when it comes to vue's class binding feature. Working in pug, although ...

Ensure that the background image adjusts appropriately to different screen sizes while maintaining its responsiveness

Currently in the process of developing a single page application using CRA. My goal is to create a hero image with an overlay at the top of the application using a background image. However, I'm facing issues with maintaining the responsiveness of the ...

Trouble with CSS Vertical Alignment: Solutions to Fix it

Link to a JSFiddle for reference: http://jsfiddle.net/STmwz/4/ Initially, there is only the top div displayed. Upon clicking the edit button, the JavaScript code replaces the top div with the bottom div. However, during this transition, there is a slight ...

Tips for utilizing slot scope effectively in vuejs 2.5.x

I've been attempting to incorporate the slot-scope feature in our Vue application (using the older syntax v2.5.x): https://v2.vuejs.org/v2/guide/components-slots.html#Scoped-Slots-with-the-slot-scope-Attribute but it doesn't seem to be functionin ...

Incorporating a recurring image beneath a navigation menu

I'm attempting to recreate a header that has a similar appearance to the following: https://i.stack.imgur.com/uVXs3.png However, I am facing challenges in generating the repeating diamond design beneath the black bar. The diamond pattern resembles t ...

Triggering a specific outcome with every user interaction involving the selection of an element

How can I trigger this effect each time the user clicks on the element using jQuery? I have added a "ripple" class upon clicking, but when I click on the element for the second time, the effect does not execute because the class has already been added. Ho ...

Developing an edit form using Vue and Axios: Incorporating a dynamic database value into the form field

I am currently working on an edit form using Vue and Axios, but I have encountered a conflict. Here is my Vue code: <script> import { required, minLength } from 'vuelidate/lib/validators' export default { created() { this ...

Using the flex:1 property does not automatically make my elements the same size and cover the entire height of the container

I have 2 containers and I want the elements in each container to fill the entire container. My goal is to make one container appear larger than the other. https://i.stack.imgur.com/73yoR.jpg Even though I am using the flex: 1 property, it does not seem t ...

Troubleshooting: Addressing the Issue of "Missing Product Attribute on Search Results"

Running into an issue while trying to map over a graphql query using an imported component. The data connection is set up correctly but encountering a problem with passing the data, resulting in the error message Missing product attribute on result. After ...

What is the reason that server.js is always excluded from the Webpack build process?

I am currently utilizing Vue.js 3 for the front end of my application, while employing Node/Express for the back-end. My goal is to implement server side rendering, but I have encountered some challenges along the way. As far as I can tell, the client-sid ...

How can I customize the hover effect of the drop-down options <option> to have a "blue" background color?

I've been struggling to change the default blue background color of the drop-down options when hovering over them with the mouse. Despite trying various solutions from this forum, nothing seems to be working at the moment. (These solutions used to wor ...

When attempting to install Vue Js, I encounter the following npm error

I recently set up Node.js using Snap on my Parrot OS system. However, I've noticed that the node_modules folder is missing after /usr/local/lib When running npm install -g @vue/cli, I encountered this error: npm WARN deprecated @hapi/[email pro ...

What could be causing `RouterView` to not display any components?

After manually inserting all components/screens in the HTML and ensuring that the URL changes without errors, I am encountering an issue where no content is displayed in <RouterView>. Any insights would be appreciated. main.ts import { createApp, Vu ...