Components Tabs Tabs Component

Tabs Component

A responsive tabs component with microinteractions for business/corporate websites, featuring complementary colors and dark mode support.

Preview

HTML Code

<div class="max-w-4xl mx-auto my-10 p-5">
  <div class="border-b border-gray-300 dark:border-gray-700">
    <nav class="flex space-x-4" aria-label="Tabs">
      <button class="tab-button active dark:bg-gray-800 dark:text-white bg-blue-500 text-white rounded-lg px-4 py-2 transition duration-200 ease-in-out" aria-current="page">Tab 1</button>
      <button class="tab-button hover:bg-blue-400 dark:hover:bg-blue-600 transition duration-200 ease-in-out rounded-lg px-4 py-2">Tab 2</button>
      <button class="tab-button hover:bg-blue-400 dark:hover:bg-blue-600 transition duration-200 ease-in-out rounded-lg px-4 py-2">Tab 3</button>
    </nav>
  </div>

  <div class="tab-content mt-4 p-5 rounded-lg border border-gray-300 dark:border-gray-700 bg-white dark:bg-gray-800">
    <div id="tab-1" class="content active">
      <h2 class="text-xl font-semibold">Content for Tab 1</h2>
      <p>This tab contains information relevant to the first topic.</p>
      <img src="https://picsum.photos/400/200" alt="Random image" class="mt-3 rounded shadow" />
    </div>
    <div id="tab-2" class="content hidden">
      <h2 class="text-xl font-semibold">Content for Tab 2</h2>
      <p>This tab contains information relevant to the second topic.</p>
      <img src="https://picsum.photos/400/200" alt="Random image" class="mt-3 rounded shadow" />
    </div>
    <div id="tab-3" class="content hidden">
      <h2 class="text-xl font-semibold">Content for Tab 3</h2>
      <p>This tab contains information relevant to the third topic.</p>
      <img src="https://picsum.photos/400/200" alt="Random image" class="mt-3 rounded shadow" />
    </div>
  </div>
</div>

<style>
  .tab-button.active {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  }

  .tab-button:hover {
    transform: scale(1.05);
  }

  .content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
  }

  .content.active {
    opacity: 1;
    transform: translateY(0);
  }

  .content.hidden {
    display: none;
  }
</style>

Related Components

Tabs Component

A responsive tabs component designed for dark mode using Tailwind CSS. It features different tabs that users can click to reveal content, along with placeholder images and avatars.

Open

Tabs Component

A brutalist-style Tabs Component for social media, with complementary colors and a complex, responsive design, including dark theme support.

Open

Tabs Component

A minimalist tabs component for e-commerce websites with interactive elements, responsive design, and dark mode support.

Open