Ways to incorporate a smooth transition between the opened and closed fab functionality

I am currently utilizing VueJS and Vuetify in my project. I have successfully implemented Vuetify's FAB component, which displays a list of fab buttons as demonstrated in the documentation:

<div id="fab-button">
  <v-speed-dial v-model="fabActiveStatus" bottom left fixed direction="top" transition="slide-y-reverse-transition" style="margin: 25px">
    <template v-slot:activator>
      <v-btn v-model="fabActiveStatus" dark fab x-large :color="fabBgColor">
        <v-icon v-if="fabActiveStatus">mdi-close</v-icon>
        <v-icon v-else>mdi-plus</v-icon>
      </v-btn>
    </template>
    <v-tooltip right>
      <template v-slot:activator="{ on, attrs }">
        <v-btn v-bind="attrs" v-on="on" fab dark :color="fabBgColor" @click="$emit('fl-btn-settings-popup', true)">
          <v-icon>mdi-upload</v-icon>
        </v-btn>
      </template>
      <span>add</span>
    </v-tooltip>
    <v-tooltip right>
      <template v-slot:activator="{ on, attrs }">
        <v-btn v-bind="attrs" v-on="on" fab dark :color="fabBgColor" @click="$emit('fl-btn-settings-popup', true)">
          <v-icon>mdi-cloud</v-icon>
        </v-btn>
      </template>
      <span>goto</span>
    </v-tooltip>
    <v-tooltip right>
      <template v-slot:activator="{ on, attrs }">
        <v-btn v-bind="attrs" v-on="on" fab dark :color="fabBgColor" @click="$emit('fl-btn-settings-popup', true)">
          <v-icon>mdi-share-variant</v-icon>
        </v-btn>
      </template>
      <span>share</span>
    </v-tooltip>
  </v-speed-dial>
</div>

While this setup functions well, I am looking to incorporate a smoother transition between opening and closing the fab buttons. I would like to achieve an animation similar to that seen in the vue-fab library:

https://i.sstatic.net/7SKzJ.png

Instead of a simple switch between the '+' and 'x' icons, I want to introduce a seamless turning motion as depicted in the examples above.

Is there a way to achieve this using Vuetify?

Answer â„–1

Customize the fab icon with your own classes and make it spin when activated:

Vue.config.productionTip = false;
Vue.config.devtools = false;
new Vue({
  el: '#app',
  vuetify: new Vuetify(),
  data: () => ({
    isFabOpen: false,
  })
})
#example {
  width: calc(100vw - 6rem);
  height: calc(100vh - 6rem);
  margin: 3rem;
}

div.theme--light.v-application {
  background-color: #f4f6f8;
}

#app .v-speed-dial {
  position: absolute;
}

#app .v-btn--floating {
  position: relative;
}


/* 👇 Add your custom classes here */

.rotator {
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
  transform: rotate(0.125turn);
}

.is-rotated {
  transform: rotate(.5turn);
}
<script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="7107041431435f475f4045">[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="2e585b4b5a4748576e1c0056">[email protected]</a>/dist/vuetify.js"></script>
<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="8bede4e5ffcbbda5f3">[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-card id="example" shaped>
      <v-container>
        <v-speed-dial v-model="isFabOpen" :bottom="true" :right="true" :direction="'top'" :transition="'slide-y-reverse-transition'">
          <template v-slot:activator>
            <v-btn
              v-model="isFabOpen"
              :color="isFabOpen ? 'red darken-2' : 'blue darken-2'"
              dark
              fab>
                             <!-- 👇 Insert your custom classes here -->
              <v-icon :class="['rotator', isFabOpen ? 'is-rotated' : '']">
                mdi-close
              </v-icon>
            </v-btn>
          </template>
          <v-btn fab dark small color="green">
            <v-icon>mdi-pencil</v-icon>
          </v-btn>
          <v-btn fab dark small color="indigo">
            <v-icon>mdi-plus</v-icon>
          </v-btn>
          <v-btn fab dark small color="red">
            <v-icon>mdi-delete</v-icon>
          </v-btn>
        </v-speed-dial>
      </v-container>
    </v-card>
  </v-app>
</div>

Experiment with different rotation values to customize the spinning effect of the icon. Values ending in .25, .5, .75, or .0 are recommended for x symmetry, while values ending in .125, .375, .625, or .875 work well for + symmetry.

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

Creating a div that displays only the initial 50 characters through CSS

My goal is to display only the first 100 characters of the Optional Clause in my card, but I'm running into problems with the CSS. The following 3 lines of code aren't working for me: white-space: nowrap; overflow: hidden; text-overflow: ellipsis ...

Creating an external JavaScript and CSS file for date picker in Eclipse can be done by following a few simple steps. By creating separate files for the

I am using the following javascript and css styles: <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/base/jquery-ui.css" type="text/css" media="all" /> <script src="http://ajax.googleapis.com/ajax/libs/jq ...

Incorporate input-style labeling into Vuetify's v-card component

https://i.stack.imgur.com/CMs0l.png Is there a way to add a label similar to a v-input's label to a v-card, just like in the example of "select" above? If so, how can this be achieved? I was considering appending a label using code, but I believe t ...

"Effortless alignment: Centralizing CSS styling across the entire

I need help placing a loading spinner in the center of my screen, ensuring it works on both mobile and desktop devices. Here is my current CSS code: .spinner { width: 100px; height: 100px; position:absolute; top: 50%; left: 50%; margin: 100px ...

The Vuejs single-file component fails to display on the page

Even though there are no errors in the browser and Webpack compiles successfully, the message "hello from dashboard" is not displaying on the page. I am currently using Vue version 2.6 In my main.js file: import Vue from 'vue' Vue.component(&a ...

CSS vertical alignment: Getting it just right

I am currently using Bootstrap and below is a snippet of the code I have implemented. <div class="row"> <div class="col-lg-6"><img src="#" alt=""></div> <div class="col-lg-6"> <h2>Heading</h2> ...

Creating an HTML table on-the-fly leads to the opening of a fresh new webpage

Has anyone encountered this issue before? I have a math table coding function, which runs when a button is clicked. However, when I click the button, the table appears on a new page instead of on the same page. <!doctype html> <html> <h ...

Struggling with implementing CSS in React even after elevating specificity levels

I am struggling with a piece of code in my component that goes like this: return ( <div className="Home" id="Home"> <Customnav color="" height="80px" padding="5vh"/> <div className= ...

The Bootstrap logo and the navbar are displayed on separate lines

I'm having trouble creating the navigation bar that I envision. I want the logo to be positioned on the top left, with the navigation bar centered on a new line below it. When the bar collapses, I want the button to align to the right of the logo on t ...

What about nested elements with percentages, set positions, and fixed placements?

Picture: https://i.sstatic.net/KFNR1.png I am working on a design with a yellow container div that I want to keep at 50% width of the window. Inside this container is a purple image div that stretches to 100% of the parent container's width, and ther ...

Can Vue.js be affected by cascading updates?

Presentations by Tom Occhino and other React speakers have discussed how Angular's 2-way bindings can lead to cascading updates, making it challenging to understand. These issues with Angular are unfamiliar to me since I haven't worked with it be ...

Ensure tables are vertically centered when printing an HTML page

I need to export two tables, each measuring 7cm×15cm, to a PDF file with A4 portrait paper size using the browser's "Save to PDF" option in the print tool. My goal is to center these two tables vertically on the A4 paper. If that proves difficult, I ...

Guide on importing CDN Vue into a vanilla Typescript file without using Vue CLI?

In the midst of a large project that is mostly developed, I find myself needing to integrate Vue.js for specific small sections of the application. To achieve this, I have opted to import Vue.js using a CDN version and a <script> </script> tag ...

Tips for dynamically loading a different component based on route parameters with the VueJS Router

I'm searching for the best way to dynamically load a different VueJS component based on the presence of props in a route. For instance, navigating to /users would display the users list page, while going to /users/1 will take you to the user ...

Can files be uploaded to the public folder in Vue.js?

Is there a method for uploading a file to the Vue.js public folder and then saving the filename in the database using an API? For example, saving an image in the Vue.js public folder and then storing the image name in the database. I would greatly apprec ...

Creating a responsive div class that is centered

Struggling to center my <div class="loginfeld"> while keeping it responsive. <html> <body> <div class ="loginfeld"> <div class="container"> <div class="col-lg-4"></div> ...

Update the scrollspy navigation in a div with overflow by toggling the active class

Struggling to implement a navigation menu within a self-scrolling div using html/css/jquery. Looking for the menu items to toggle the active class when in view or at the top of the scrolling div. I'm essentially trying to achieve something like this ...

Issue with Django app: Bootstrap 4 modal hidden behind background

Having exhaustively researched this issue, I am still unable to resolve it with the outdated Bootstrap solutions available. The problem arises when I click on the button - the modal appears behind the background instead of in front. Most suggestions indica ...

Clickable list element with a button on top

Within my web application, there is a list displaying options for the user. Each 'li' element within this list is clickable, allowing the user to navigate to their selected option. Additionally, every 'li' element contains two buttons - ...

Finding solutions for activating items and setting data sources in Bootstrap carousel thumbnails for Wordpress

I recently attempted to incorporate a bootstrap-powered carousel with thumbnails into my product slider. I managed to get it working for the main image (large image), but ran into issues when trying to resolve problems with the thumbnail section. Here is ...