Tabs component

Tabs Generator

Options
3
8px
Colors
Content for Tab 1
Content for Tab 2
Content for Tab 3
html
<div class="tabs">
  <input type="radio" class="tabs__radio" name="tabs-example" id="tab1" checked>
  <label for="tab1" class="tabs__label">Tab 1</label>
  <div class="tabs__content">Content for Tab 1</div>
  <input type="radio" class="tabs__radio" name="tabs-example" id="tab2" >
  <label for="tab2" class="tabs__label">Tab 2</label>
  <div class="tabs__content">Content for Tab 2</div>
  <input type="radio" class="tabs__radio" name="tabs-example" id="tab3" >
  <label for="tab3" class="tabs__label">Tab 3</label>
  <div class="tabs__content">Content for Tab 3</div>
</div>
css
.tabs {
  display: flex;
  flex-wrap: wrap;
  max-width: 600px;
  font-family: sans-serif;
}

.tabs__radio {
  display: none;
}

.tabs__label {
  padding: 10px 16px;
  cursor: pointer;
  background-color: #f1f5f9;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
  margin-right: 4px;
  font-weight: 500;
  transition: all 0.2s;
}

.tabs__content {
  order: 1;
  width: 100%;
  border-bottom: 3px solid #3b82f6;
  line-height: 1.5;
  padding: 20px;
  display: none;
  background-color: #fff;
}

.tabs__radio:checked + .tabs__label {
  background-color: #3b82f6;
  color: #fff;
}

.tabs__radio:checked + .tabs__label + .tabs__content {
  display: block;
}

GET MORE FROM THIS RESOURCE

Switch related views without hiding the journey

Tabs work well for a few related views in the same context. They are less suitable when visitors need to read each section in order. A styled row of tab labels is only the visual layer; panel switching and keyboard behavior need to be implemented in the application.

Use the generator to establish the appearance, then adapt the exported markup and styles to your application. A preview demonstrates the visual treatment; it does not certify your final interaction. Check the implementation with real content, a narrow screen, and keyboard input before publishing.

Try the component in the code editor →