Back to Top Button
Back to Top button with Neumorphic design, Monochromatic color scheme, and dark mode support. Uses Tailwind CSS.
HTML Code
<template>
<button
:class="[
'fixed bottom-6 right-6 p-4 rounded-full shadow-lg transition-all duration-300',
'bg-gray-200 text-gray-700',
'dark:bg-gray-700 dark:text-gray-200 dark:shadow-lg-dark',
'hover:shadow-xl hover:-translate-y-1',
'dark:hover:shadow-xl-dark dark:hover:-translate-y-1',
]"
@click="scrollToTop"
v-show="isVisible"
>
<svg
xmlns="http://www.w3.org/2000/svg"
class="h-6 w-6"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
>
<path
stroke-linecap="round"
stroke-linejoin="round"
stroke-width="2"
d="M5 10l7-7m0 0l7 7m-7-7v18"
/>
</svg>
</button>
</template>
<script setup>
import { ref, onMounted, onUnmounted } from 'vue';
const isVisible = ref(false);
const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: 'smooth' });
};
const handleScroll = () => {
isVisible.value = window.scrollY > 100;
};
onMounted(() => {
window.addEventListener('scroll', handleScroll);
});
onUnmounted(() => {
window.removeEventListener('scroll', handleScroll);
});
</script>
<style scoped>
.shadow-lg {
box-shadow: 7px 7px 14px #cbced1, -7px -7px 14px #ffffff;
}
.shadow-xl {
box-shadow: 9px 9px 18px #cbced1, -9px -9px 18px #ffffff;
}
.dark .shadow-lg-dark {
box-shadow: 7px 7px 14px #4a4a4a, -7px -7px 14px #626262;
}
.dark .shadow-xl-dark {
box-shadow: 9px 9px 18px #4a4a4a, -9px -9px 18px #626262;
}
</style>
Related Components
Back to Top Button Component - Brutalism Earth Tones
A complex 'Back to Top' button component designed in a brutalist style with an earthy color scheme, suitable for blog/content sites. It is responsive and includes dark mode support.
Brutalism_Earth_Tone_Back_To_Top_Button
A brutalist-inspired 'Back to Top' button with earth tones, designed for blog/content sites. It's moderately complex, responsive, and supports dark mode. The button features a high-contrast design and a slightly crude aesthetic.
Neumorphic Back to Top Button
A neumorphic "Back to Top" button for e-commerce, offering a subtle, soft UI design that blends with the background using delicate shadows. It features analogous colors for a harmonious look, a simple layout, and responsive design with dark theme support, ideal for online shopping experiences.