A tabs bar + panels component which works entirely without JS. Supports height equalization and automatic vertical scroll bar for tabs bar.
npm install astro-tabs
!Downloads







A tabs bar + panels component which works entirely without JS.
Supports height equalization and automatic vertical scroll bar for tabs bar.
> Note: It uses the :has() CSS selector under the hood.
---
https://user-images.githubusercontent.com/603498/195471643-f5dac29e-f10c-4038-979b-53fbc977190e.mp4
---
``sh`
pnpm i astro-tabs
WITHOUT "tallest" equalization
`astro
---
import { Tabs } from 'astro-tabs';
// ...
---
Hello world
Panel 1
Panel 2
height="400"
src="https://res.cloudinary.com/dzfylx93l/image/upload/v1664340439/astro-takeoff-1_ecdfxf.gif"
/>
Panel 3
`
WITH "tallest" panel equalization, use panel-
`astro
Hello world
Panel 1
Panel 2
height="400"
src="https://res.cloudinary.com/dzfylx93l/image/upload/v1664340439/astro-takeoff-1_ecdfxf.gif"
/>
Heya
Panel 3
`
`scss
.tab {
color: white;
padding: 1rem;
background-color: teal;
border: 1px solid cyan;
&:hover {
color: black;
background-color: cyan;
}
}
.tab-selector:checked ~ .tab {
color: black;
background: turquoise;
}
.panel {
padding: 1rem;
background-color: lightcyan;
border: 3px solid darkcyan;
}
`
Or use :global(.tab),โฆ in scoped styles.
` Hello world html`
Panel 1