← 一覧へ

Tab Menu / 16 サークルボタン|Circle Button

デザイン見本

  • Tab 1
  • Tab 2
  • Tab 3
Good morning. This is the content of Tab 1.
Hello. This is the content of Tab 2.
Good evening. This is the content of Tab 3.

正円のアイコン風ボタンを並べた、ユニークなデザインです。選択時に波紋のようなエフェクトと共に拡大し、視覚的なフィードバックを強調します。少ないタブ数で、直感的な操作を促したい場合に適しています。

実装コード

HTML
<div class="tab-container">
  <ul>
    <li class="selected" data-id="tab-1">Tab 1</li>
    <li data-id="tab-2">Tab 2</li>
    <li data-id="tab-3">Tab 3</li>
  </ul>
  <div class="tab-content selected" id="tab-1">
    Tab 1 のコンテンツ
  </div>
  <div class="tab-content" id="tab-2">
    Tab 2 のコンテンツ
  </div>
  <div class="tab-content" id="tab-3">
    Tab 3 のコンテンツ
  </div>
</div>
CSS
.tab-container {
  border-radius: 20px;
  position: relative;
}

.tab-container ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 30px;
  position: relative;
}

.tab-container ul li {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  color: #666;
  font-weight: 600;
  font-size: 14px;
  background: #fff;
  border: 3px solid #e0e0e0;
  box-shadow: 
      0 4px 12px rgba(0, 0, 0, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.8);
  overflow: hidden;
}

.tab-container ul li::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  transform: scale(0);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: -1;
}

.tab-container ul li.selected {
  color: #fff;
  border-color: #667eea;
  box-shadow: 
      0 8px 24px rgba(102, 126, 234, 0.4),
      inset 0 2px 4px rgba(255, 255, 255, 0.3);
  transform: translateY(-4px) scale(1.05);
}

.tab-container ul li.selected::before {
  transform: scale(1);
}

.tab-container ul li:not(.selected):hover {
  border-color: #667eea;
  color: #667eea;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 
      0 6px 20px rgba(102, 126, 234, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.tab-container .tab-content {
  display: none;
  padding: 30px;
  min-height: 180px;
  background: #fff;
  color: #333;
  border-radius: 16px;
  box-shadow: 
      0 4px 16px rgba(0, 0, 0, 0.1),
      inset 0 1px 0 rgba(255, 255, 255, 0.8);
  position: relative;
  overflow: hidden;
}

.tab-container .tab-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #667eea, #764ba2);
  border-radius: 16px 16px 0 0;
}

.tab-container .tab-content.selected {
  display: block;
  animation: circleButtonFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes circleButtonFadeIn {
  from { 
      opacity: 0; 
      transform: translateY(-20px) scale(0.95);
  }
  to { 
      opacity: 1; 
      transform: translateY(0) scale(1);
  }
}
JS
const tabContainer = document.querySelector('.tab-container');
const tabMenuItems = tabContainer.querySelectorAll('ul li');
const tabContents = tabContainer.querySelectorAll('.tab-content');

tabMenuItems.forEach(tabMenuItem => {
  tabMenuItem.addEventListener('click', () => {
    tabMenuItems.forEach(item => {
      item.classList.remove('selected');
    });
    tabMenuItem.classList.add('selected');

    tabContents.forEach(tabContent => {
      tabContent.classList.remove('selected');
    });
    document.getElementById(tabMenuItem.dataset.id).classList.add('selected');
  });
});