Building a custom Vuetify extension to enhance core features

I am currently working on developing a plugin-based component library to ensure consistency across various product lines using vuetify. However, when I try to install the library and add the components, I encounter multiple errors related to the dark theme.

Both the component library and the target product line have vuetify installed via the vue-cli.

<template>
     <div class="module-wrap">
        <v-card v-bind="$attrs" v-on="$listeners" :class="`dashboard-module units`">
            <v-toolbar flat dense :color="color">
                <v-toolbar-title>{{title}}</v-toolbar-title>
                <v-spacer></v-spacer>
                <v-menu v-bind="$attrs" v-on="$listeners"  class="menu" offset-y>
                    <template v-slot:activator="{ on }">
                        <v-btn class="menu-opener" icon v-on="on">
                            <font-awesome-icon icon="ellipsis-h"></font-awesome-icon>
                        </v-btn>
                    </template>
                    <v-list>
                        <v-list-tile class="tooltip" @click="dialog = true">
                            <v-list-tile-avatar>
                                <font-awesome-icon icon="info"/>
                            </v-list-tile-avatar>
                            <v-list-tile-content>
                                <v-list-tile-title>Information</v-list-tile-title>
                            </v-list-tile-content>
                        </v-list-tile>
                        <v-list-tile class="favorite" @click="$emit('favorite')">
                            <v-list-tile-avatar>
                                <font-awesome-icon icon="star"/>
                            </v-list-tile-avatar>
                            <v-list-tile-content>
                                <v-list-tile-title>Save To Favorites</v-list-tile-title>
                            </v-list-tile-content>
                        </v-list-tile>
                        <v-list-tile class="export" v-if="!disableExport" @click="$emit('export')">
                            <v-list-tile-avatar>
                                <font-awesome-icon icon="file-export"/> 
                            </v-list-tile-avatar>
                            <v-list-tile-content>
                                <v-list-tile-title>Export</v-list-tile-title>
                            </v-list-tile-content>
                        </v-list-tile>
                    </v-list>
                </v-menu>
            </v-toolbar>
            <div :class="`content`">
                <slot></slot>
            </div>
            <v-card-text>
                <slot name="card-text"></slot>
            </v-card-text>
            <v-dialog v-model="dialog" width="500">
                <v-card>
                    <v-card-title>
                        <div class="headline">{{title}}</div>
                    </v-card-title>
                    <v-card-text>
                        <slot name="tooltip"></slot>
                    </v-card-text>
                    
                    <v-card-actions>
                        <v-spacer></v-spacer>
                        <v-btn @click="dialog = false" flat color="primary">Ok</v-btn>
                    </v-card-actions>
                </v-card>
            </v-dialog>
        </v-card>
    </div>
</template>

<script lang="ts">

export default {
    // props:['color', 'module', 'title'],
    props: {
        color:String,
        title:String,
        disableExport:Boolean
    },
    
    data() {
        return {
            dialog:false
        }
    }
}
</script>

<style scoped>

.dashboard-module {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.content {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 100%;
}

</style>

^ Component from library

webpack-internal:///./node_modules/dashboard-components/node_modules/vue/dist/vue.runtime.esm.js:620 [Vue warn]: Error in render: "TypeError: Cannot read property 'dark' of undefined"

found in

---> <VMenu>
       <TDashboardModule>
         <App> at src/App.vue
           <Root>

TypeError: Cannot read property 'dark' of undefined

[Vue warn]: Error in getter for watcher "isDark": "TypeError: Cannot read property 'dark' of undefined"

found in

---> <ThemeProvider>
       <VDialog>
         <TDashboardModule>
           <App> at src/App.vue
             <Root>

^ Encountered Issues

vuetify Version 1.5.14

Answer №1

Have you configured the theme color? If not, refer to the guidelines in the documentation:

Vuetify offers both light and dark variants of the Material Design specification. This distinction begins at the root application component, v-app, and is supported by most components. By default, your application will utilize the light theme, however this can be easily overridden by adding the dark prop.

<v-app dark>

If you prefer not to apply a single color scheme to everything, you can specify a prop like dark to individual components to switch them to the dark theme:

<v-menu dark>

Read more about the menu component in the documentation

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

Specify the controller to be used dynamically in an Angular directive

I want to be able to specify the controller that a directive uses by adding an attribute to the element - in other words, dynamically: HTML <div data-mydirective data-ctrl="DynamicController"></div> Angular angular.module('app', [ ...

Utilizing TypeScript Class Inheritance: The Reference to 'super' is Only Allowed in Members of Derived Classes or Object Literal Expressions

We have encountered a scoping issue while using TypeScript classes with inheritance. It seems that TypeScript/JavaScript does not allow us to use 'super' within a promise structure or an enclosed function. The error message we are getting is: Ty ...

Combining arrays of objects in VueJS

I am working with 2 components: parent component (using vue-bootstrap modal with a vue-bootstrap table) child component (utilizing vue-bootstrap modal with a form) Issue: When I submit the form in the child component, it successfully adds the object to ...

Second attempt at initiating Ajax request fails

My ajax/php structure works perfectly when selecting one image. However, if I click on "selecteer" to perform the same code for the second time, no images are displayed. The "ajax" page loads correctly each time. Here's the setup: Article page: Disp ...

Tips for sending a JavaScript parameter to PHP

I am implementing a pop-up modal window that retrieves data from the myForm and saves the email field value to a JavaScript variable in index.php. How can I pass this JavaScript value to PHP and display it using echo, without refreshing the index.php windo ...

What is the best way to create a sharp light effect on a sphere in three.js?

My three.js scene features a sphere and directional light. The sphere appears to gradually darken as you look at it. How can I speed up the transition from light to dark? Is there a way to make the light appear "sharper"? var scene, camera, renderer, co ...

What is the best way to connect tags with their corresponding tag synonyms?

I'm currently developing a system where users can link tags to posts, similar to how it's done on SO. I'm facing some challenges when it comes to implementing tag synonyms. Let's take a look at the Tags table: | TagName | |-------- ...

How can we ensure successful validation using Jquery?

I'm currently working on a basic form that includes text fields. Whenever these text fields are modified, an Ajax function is called to save the changes. However, I am facing a challenge in validating these fields using jQuery before the change even ...

Vuejs v-model input value does not refresh dynamic data updates

I am currently working on incorporating the "pokemonName" parameter into the API URL that is being accessed through axios. The aim is to showcase the JSON data for each newly entered Pokémon by the user in a text input field. Below is my HTML code: &l ...

Stop the promise chain when the first error callback is encountered

Here is a sequence of promises I am dealing with: Transaction.findPublic({}).then(function(transactions) { combined = combined.concat(transactions); return JoinEvent.find().exec(); }, function(err) { return res.status(503).send(er ...

Incorporating CouchDB storage into a Node.js socket.io JSON data stream

Currently in the process of researching how to implement persistence for a real-time Twitter JSON feed in Node.js. The stream is set up and sending data to the client, but I'm struggling with storing this information in a CouchDB database so that it c ...

Arrange a div element within another div by utilizing the fixed positioning property, while also accounting for any potential "white space

Can someone help me figure this out: I currently have this much progress: http://jsbin.com/apikiw/3/edit#preview The issue I'm facing is that I am unable to insert it between the <p /> tags due to its dynamic nature... any solutions or suggest ...

How can I extract the text enclosed in <li> tags using JavaScript?

Can someone help me with retrieving the text content of li tags? I managed to get a list of lis, but I'm having trouble assigning the text content to my country object. Snippet var lis = document.getElementById("navbar").getElementsByTagName("l ...

A guide to displaying numerous notifications using notistack in a React environment

I'm currently experimenting with React's 'notistack' module to showcase multiple notifications as a stack. However, it seems like I might be making an error since every time I encounter a warning: react_devtools_backend.js:3973 Warning ...

Returning a Response in HapiJS Routes from Incoming Requests

Currently, I am facing an issue with the request module where I am able to successfully make a request and receive a response. However, I am struggling to figure out how to pass this response back to my route in order to return it to my client. Here is th ...

Are HTML5 Track Element Cue Events Working Properly?

My goal is to dynamically assign functions to HTML5's cue.onenter events. This feature is relatively new and currently only supported in Chrome with specific flags enabled (Refer to the example on HTML5 Rocks here). However, I seem to be facing some ...

I could use some help understanding how to identify the parent file so I can elevate a state

I'm facing a challenge in lifting up a state so that I can utilize it across various pages. The confusion lies in determining where to reference the states, given the uncertainty regarding the parent location. Since this is my first attempt at designi ...

Is there a way for me to locate the ownerID?

I have a simple task that I need to complete My goal is for the user to be identified using my token when creating a post This is how the create function looks like: exports.create = async (req, res) => { const user = req.token; const users = awai ...

React encountered an issue: each child element within a list must be assigned a unique "key" prop

I am feeling a bit puzzled as to why I keep getting the error message: child in a list should have a unique "key" prop. In my SearchFilterCategory component, I have made sure to add a key for each list item using a unique id. Can you help me figu ...

Dynamically indicate the destination for AJAX success feedback across various forms

Here are a couple of inquiries: Is there a way to incorporate a second form on the same page and dynamically handle each form based on which submit button is clicked? Let's say I have several forms on one page. How can I alter the output destina ...