# Tabs Pure CSS tabs using `
` and `` with CSS Grid and Subgrid. No JavaScript required. ## Basic Example (3 Tabs) ```html
Tab 1
Content for tab 1
Tab 2
Content for tab 2
Tab 3
Content for tab 3
``` ## How It Works - The `name` attribute on `
` ensures only one tab can be open at a time (native HTML behavior) - `--n` CSS variable positions each tab's summary in the correct grid column - `--tab-count` on the container sets the number of columns (default: 3) ## Custom Tab Count For 4 or more tabs, set `--tab-count`: ```html
Tab 1
Content 1
Tab 2
Content 2
Tab 3
Content 3
Tab 4
Content 4
``` ## Boxed Variant (Card-Style) Tabs that visually connect to the panel below: ```html
Account
Account settings content
Security
Security settings content
Billing
Billing settings content
``` ## Pill Variant Rounded pill-style tabs with primary color active state: ```html
All
All items
Active
Active items
Archived
Archived items
``` ## Important Notes 1. **Unique names**: Each tab group needs a unique `name` attribute 2. **Open one by default**: Add `open` to the tab that should be visible initially 3. **Sequential --n values**: Must match the visual order (1, 2, 3, etc.) 4. **Match --tab-count**: If you have more than 3 tabs, set `--tab-count` to match ## Styling Details - Uses CSS Grid with Subgrid for alignment - Smooth opacity transitions with `@starting-style` - Works in light and dark modes - Keyboard accessible (native details/summary behavior) - Active tab has underline indicator (default), card connection (boxed), or filled pill (pill) ## See Also - [Accordion](https://graffiti-ui.com/llms/accordion.txt) - Single collapsible sections