Tabs

Documentation and examples for how to use tabs with Alpine js.

Example tabs

Placeholder content for the tab panel. This one relates to the home tab. Takes you miles high, so high, 'cause she’s got that one international smile. There's a stranger in my bed, there's a pounding in my head. Oh, no. In another life I would make you stay. ‘Cause I, I’m capable of anything. Suiting up for my crowning battle. Used to steal your parents' liquor and climb to the roof. Tone, tan fit and ready, turn it up cause its gettin' heavy. Her love is like a drug. I guess that I forgot I had a choice.

Placeholder content for the tab panel. This one relates to the profile tab. You got the finest architecture. Passport stamps, she's cosmopolitan. Fine, fresh, fierce, we got it on lock. Never planned that one day I'd be losing you. She eats your heart out. Your kiss is cosmic, every move is magic. I mean the ones, I mean like she's the one. Greetings loved ones let's take a journey. Just own the night like the 4th of July! But you'd rather get wasted.

Placeholder content for the tab panel. This one relates to the contact tab. Her love is like a drug. All my girls vintage Chanel baby. Got a motel and built a fort out of sheets. 'Cause she's the muse and the artist. (This is how we do) So you wanna play with magic. So just be sure before you give it all to me. I'm walking, I'm walking on air (tonight). Skip the talk, heard it all, time to walk the walk. Catch her if you can. Stinging like a bee I earned my stripes.

                
                  <!-- tabs -->
                  <div x-data="{ tabs: 1 }">
                    <ul class="flex border-b">
                      <li @click="tabs = 1" :class="{ '-mb-px': tabs === 1 }" class="mr-1">
                        <a :class="{ '-mb-px border-l border-t border-r rounded-t text-blue-700': tabs === 1 }" class="bg-white inline-block py-2 px-4 hover:text-blue-700 font-semibold" href="javascript:;">Home</a>
                      </li>
                      <li @click="tabs = 2" :class="{ '-mb-px': tabs === 2 }" class="mr-1">
                        <a :class="{ 'border-l border-t border-r rounded-t text-blue-700': tabs === 2 }" class="bg-white inline-block py-2 px-4 hover:text-blue-700 font-semibold" href="javascript:;">Profile</a>
                      </li>
                      <li @click="tabs = 3" :class="{ '-mb-px': tabs === 3 }" class="mr-1">
                        <a :class="{ 'border-l border-t border-r rounded-t text-blue-700': tabs === 3 }" class="bg-white inline-block py-2 px-4 hover:text-blue-700 font-semibold" href="javascript:;">Contact</a>
                      </li>
                    </ul>
                    <div class="w-full pt-4">
                      <div x-show="tabs === 1">......</div>
                      <div x-show="tabs === 2">......</div>
                      <div x-show="tabs === 3">......</div>
                    </div>
                  </div>
                
              

Vertical tabs

Placeholder content for the tab panel. This one relates to the home tab. Takes you miles high, so high, 'cause she’s got that one international smile. There's a stranger in my bed, there's a pounding in my head. Oh, no. In another life I would make you stay. ‘Cause I, I’m capable of anything. Suiting up for my crowning battle. Used to steal your parents' liquor and climb to the roof. Tone, tan fit and ready, turn it up cause its gettin' heavy. Her love is like a drug. I guess that I forgot I had a choice.

Placeholder content for the tab panel. This one relates to the profile tab. You got the finest architecture. Passport stamps, she's cosmopolitan. Fine, fresh, fierce, we got it on lock. Never planned that one day I'd be losing you. She eats your heart out. Your kiss is cosmic, every move is magic. I mean the ones, I mean like she's the one. Greetings loved ones let's take a journey. Just own the night like the 4th of July! But you'd rather get wasted.

Placeholder content for the tab panel. This one relates to the contact tab. Her love is like a drug. All my girls vintage Chanel baby. Got a motel and built a fort out of sheets. 'Cause she's the muse and the artist. (This is how we do) So you wanna play with magic. So just be sure before you give it all to me. I'm walking, I'm walking on air (tonight). Skip the talk, heard it all, time to walk the walk. Catch her if you can. Stinging like a bee I earned my stripes.

                
                  <!-- vertical tabs -->
                  <div x-data="{ tabs: 1 }" class="flex justify-between -mx-4">
                    <ul class="max-w-full px-4">
                      <li @click="tabs = 1" :class="{ '-mr-px': tabs === 1 }" class="mr-1">
                        <a :class="{ 'bg-blue-700 text-gray-100 rounded': tabs === 1 }" class="bg-white text-center block py-2 px-4 font-semibold mb-4" href="javascript:;">Home</a>
                      </li>
                      <li @click="tabs = 2" :class="{ '-mr-px': tabs === 2 }" class="mr-1">
                        <a :class="{ 'bg-blue-700 text-gray-100 rounded': tabs === 2 }" class="bg-white text-center block py-2 px-4 font-semibold mb-4" href="javascript:;">Profile</a>
                      </li>
                      <li @click="tabs = 3" :class="{ '-mr-px': tabs === 3 }" class="mr-1">
                        <a :class="{ 'bg-blue-700 text-gray-100 rounded': tabs === 3 }" class="bg-white text-center block py-2 px-4 font-semibold mb-4" href="javascript:;">Contact</a>
                      </li>
                    </ul>
                    <div class="max-w-full px-4">
                      <div x-show="tabs === 1">......</div>
                      <div x-show="tabs === 2">......</div>
                      <div x-show="tabs === 3">......</div>
                    </div>
                  </div>