CSS Folder Tabs
File-folder style tabs where the selected tab merges into its panel, switched with radio buttons.
<div class="folder-tabs">
<div class="folder-tabs-list" role="radiogroup" aria-label="Documents">
<label><input type="radio" name="folder-tabs" checked>Notes</label>
<label><input type="radio" name="folder-tabs">Files</label>
<label><input type="radio" name="folder-tabs">Links</label>
</div>
<div class="folder-tabs-panels">
<div>3 notes from this week.</div>
<div>12 files, 48 MB in total.</div>
<div>5 saved links.</div>
</div>
</div>
.folder-tabs {
width: 250px;
font: 14px/1.5 system-ui, sans-serif;
}
.folder-tabs-list {
display: flex;
gap: 4px;
padding-left: 8px;
}
.folder-tabs-list label {
padding: 8px 16px 10px;
border-radius: 12px 12px 0 0;
background: #c7d2fe;
color: #4338ca;
font-weight: 600;
cursor: pointer;
transition: background-color 0.2s ease;
}
.folder-tabs-list label:hover {
background: #a5b4fc;
}
.folder-tabs-list input {
position: absolute;
opacity: 0;
pointer-events: none;
}
/* Selected tab takes the panel color, so they read as one shape */
.folder-tabs-list label:has(input:checked) {
background: #ffffff;
color: #1e1b4b;
}
.folder-tabs-list label:has(input:focus-visible) {
outline: 2px solid #4338ca;
outline-offset: -4px;
}
.folder-tabs-panels {
min-height: 70px;
padding: 16px;
border-radius: 12px;
background: #ffffff;
color: #334155;
box-shadow: 0 10px 24px -12px #312e8159;
}
.folder-tabs-panels > div {
display: none;
}
.folder-tabs:has(label:nth-child(1) input:checked) .folder-tabs-panels > :nth-child(1),
.folder-tabs:has(label:nth-child(2) input:checked) .folder-tabs-panels > :nth-child(2),
.folder-tabs:has(label:nth-child(3) input:checked) .folder-tabs-panels > :nth-child(3) {
display: block;
}
About this CSS Folder Tabs
This CSS Folder Tabs is 60 lines of pure CSS (1.2 KB) with no JavaScript and no dependencies. It uses transitions, box shadows, Flexbox and the :has() selector. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
- transitions
- box shadows
- Flexbox
- the :has() selectorChrome 105+, Safari 15.4+, Firefox 121+.
- the :checked state (no JavaScript)
- keyboard focus styles
Customize it
The colors in this snippet. Search and replace them to match your brand:
#c7d2fe#4338ca#a5b4fc#ffffff#1e1b4b#334155#312e8159
How to use this folder tabs
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.folder-tabsclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.