Animations/Anti-Grid Tabs

Anti-Grid Tabs

Tabs avec courbes concaves qui fusionnent visuellement avec le contenu. Technique mastra.ai.

clickCSStabsSaaSadvanced
Trigger: Click
CSS requis: Non
Difficulte: hard

Preview live

Code

{/* Tab actif: rounded-t, pas de border-bottom */}
<button className={isActive ? "rounded-t-[42px] rounded-b-none bg-surface" : "rounded-[42px] bg-surface"}
  style={{ borderBottom: isActive ? "1.6px solid surfaceColor" : "1.6px solid borderColor" }}>
  {tab.label}
</button>

{/* Bridge avec courbes concaves */}
{isActive && (
  <div style={{ top: TAB_HEIGHT, width: "100%", height: GAP }}>
    <div className="w-full h-full bg-surface" />
    {/* Concave gauche */}
    <div className="absolute overflow-hidden"
      style={{ left: "1.6px", bottom: 0, transform: "translateX(-100%)", width: 32, height: 32 }}>
      <div style={{ borderRadius: "0 0 32px 0", boxShadow: "0 0 0 32px surfaceColor" }} />
    </div>
    {/* Concave droite */}
    <div className="absolute overflow-hidden"
      style={{ right: "1.6px", bottom: 0, transform: "translateX(100%)", width: 32, height: 32 }}>
      <div style={{ borderRadius: "0 0 0 32px", boxShadow: "0 0 0 32px surfaceColor" }} />
    </div>
  </div>
)}

{/* Content card: border-radius dynamique */}
<div style={{
  borderTopLeftRadius: activeIdx === 0 ? 0 : 42,
  borderTopRightRadius: activeIdx === lastIdx ? 0 : 42,
  borderBottomLeftRadius: 42, borderBottomRightRadius: 42,
}}>...</div>

Instructions

La technique concave utilise borderRadius + boxShadow (pas clip-path). Le bridge remplit le gap entre tab et contenu. Le border-radius du content card s'adapte dynamiquement a la position du tab actif (0 sous le tab actif, 42px sinon).