Components Back to Top Button Back to Top Button Component

Back to Top Button Component

A responsive 'Back to Top' button that follows Material Design principles, supporting dark mode with Tailwind CSS for styling and responsive effects.

Preview

HTML Code

<div class="fixed bottom-5 right-5 z-50">
    <button class="bg-blue-500 text-white rounded-full p-2 shadow-lg transition-transform transform hover:scale-110 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-opacity-50 dark:bg-blue-700 dark:shadow-md dark:focus:ring-blue-300">
        <svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m0 0L8 16m4 4l4-4" />
        </svg>
    </button>
</div>

<style>
  /* Tailwind dark mode support */
  @media (prefers-color-scheme: dark) {
      .bg-blue-500 { background-color: #3b82f6; }
      .bg-blue-700 { background-color: #2563eb; }
      .text-white { color: #ffffff; }
      .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
      .dark .shadow-md { box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.3); }
  }
</style>

Related Components

Back to Top Button Component

A responsive 'Back to Top' button with an artistic watercolor design, autumn color scheme, and dark mode support, suitable for blog/content sites.

Open

Back to Top Button Component

A responsive back to top button designed with microinteractions and vibrant colors, suitable for a dashboard interface with dark mode support.

Open

Back to Top Button - 3D Design

A Back to Top button with a 3D design, responsive effects, and dark theme support using Tailwind CSS. No JavaScript is included.

Open