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

React Side Panels that Collapse and Expand

Apologies if this task seems simple, as I am new to transitioning to React. My current application is primarily built with JavaScript, CSS, and HTML, and I am now looking to migrate it to React. There is a full-length horizontal side panel that is initiall ...

Looking for assistance with CSS to properly align a dozen items

UPDATE: See the current layout in this JFiddle based on feedback received from others, still a few tweaks needed. In my setup, there are 12 divs housed within one container div. These 12 divs consist of 6 text components and 6 corresponding input fields. ...

Sliding Toggle: Panel Revealed with Button Slide

Currently, I am working on implementing a jquery slide tab feature. The functionality is working fine on button click. However, I want the button to stick with the panel and slide along with it. At the moment, the button remains fixed while the panel slide ...

Encountering intellisense problems while declaring or utilizing TypeScript types/interfaces within Vue.js Single File Component (SFC) documents

For my Nuxt 3 project, I am developing a component and attempting to declare an interface for the component props to ensure strong typings. Here is an example: <script setup> interface Props { float: number; } const props = defineProps<Props> ...

There was an issue with the SidebarController function being undefined, as it was expected to be a function

I'm encountering two issues with my demo: Error: [ng:areq] Argument 'SidebarController' is not a function, received undefined http://errors.angularjs.org/1.2.26/ng/areq?p0=SidebarController&p1=not%20aNaNunction%2C%20got%20undefined ...

Tips for designing a pre-selection process

I've been considering the idea of implementing a temporary screen that allows users to choose between different options before proceeding to a specific page. For instance, on the contact page, users would be prompted with a question like "Are you loo ...

Please request user input in order to generate a multiplication chart

Is there a way to ensure that the program works properly so that when the user inputs a value, it is included in the multiplication table? <html> <head> <title> Multiplication Table </title> <style> body{ font-family: aria ...

Can someone please provide me with a Javascript code snippet that accomplishes the same function

<script> document.addEventListener('DOMContentLoaded', function () { const menuItems = document.querySelectorAll('.headmenu li'); menuItems.forEach(function (menuItem) { menuItem.addEventL ...

Alter the CSS display based on the user's userAgent if they are using an iPhone and window.navigator.standalone is set to true

Looking to create a unique webAPP with different content displays based on how it is accessed. If the user opens the webAPP through their Safari browser Or if they open the webAPP from a webclip on their home screen The detection is functioning, as conf ...

Achieving VueJS reactivity by initializing a variable within the mounted function

I am facing an issue with a dynamic component that builds multiple select elements. Here is the template code: <template> <div> <b-field v-for="(key,index) in allSelects" :key="index" :label=" ...

Internet Explorer 9 users experience a sudden blank page display

Are there any effective methods for diagnosing why a page suddenly becomes blank in Internet Explorer? I am aware that switching to Compatibility Mode 7 is an option, however dealing with the quirks of IE7 can be even more challenging. ...

Displaying a live feed of documents from Firestore with a changing time frame

I am in the process of creating an application that dispatches vehicles to transport passengers from one location to another. I have a specific requirement to display a list of upcoming trips occurring within the next 24 hours, which are not yet completed. ...

Create a dynamic HTML design with a resizable left panel and a static right panel. The left panel should not wrap text and display ellipsis if necessary

I am looking to display items in a list with a specific format: |Name | Some other val1| |Very very long no wrap line that...| Some other val2| The right side needs to have a fixed width. The left side should fill al ...

The Vuesax Vx-Select feature does not display the chosen label

I am currently using NuxtJs version 2.14 along with vuesax version 4.0.1-alpha.25 installed via npm. The issue I am facing is that when I use the following code section to create a loop for v-select, the component does not display the selected label after ...

"Utilizing Bootstrap to ensure content is aligned perfectly to the baseline

I've been struggling to align my contents to the baseline while working with the bootstrap framework. I tried following the instructions in the documentation, but it didn't work out as expected. <div class="row"> <div class="col-12 ...

Step-by-step guide: Assigning a color to a card element in MaterializeCSS

I am currently working on a project using Vue.js where I want to display colored cards from MaterializeCSS. The colors are stored as hex codes in a separate database and are part of items looped through with the v-for loop, like this: <div ...

Vue Axios - token value is not defined

In my Vue SPA, I am utilizing Axios for handling requests, vue-axios for implementation, and vuex for storing tokens. However, when I send a request, the Authorization header ends up as either Bearer undefined or Bearer null. The process is that upon logg ...

What is the best way to display a Vuex state based on a function being activated?

I have noticed similar questions on this topic but couldn't find a solution, so I decided to create my own. Here's the issue: I have an array named "allCountries" in the state, initially filled with 250 country objects. I am successfully render ...

The highlight_row function seems to be delayed, as it does not trigger on the initial onClick but works on subsequent clicks. How can I ensure it works properly right from the first click?

I developed an application using the Google JavaScript Maps API to calculate distances between addresses. I've encountered a bug where the row in the table is not highlighted on the first click, requiring a second click for the highlighting to take ef ...

The animation of a cube rotating to a different face is not functioning properly when using three.js

Why is my cube not animating when rotating to another face with the code below? How can I resolve this issue? new Vue({ el: '#app', data () { return { camera: null, scene: null, renderer: null, mesh: null, ...