--- url: "https://web.dev/articles/building/a-tabs-component" titulek: "Building a Tabs component | Articles | web.dev" h1: "Building a Tabs component Stay organized with collections Save and categorize content based on your preferences." popis: "A foundational overview of how to build a tabs component similar to those found in iOS and Android apps." jazyk: "en" kanonicka: "https://web.dev/articles/building/a-tabs-component" drobecky: ["Articles", "Building a Tabs component"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-14 00:57:20" znaku: 22824 slov: 3579 kodovani: "iso-8859-2" sha256: "292ae3c8463fa9ebc810ee3d547b959f6111e1a6becd79da28784c360dbe8eba" --- Building a Tabs component Stay organized with collections Save and categorize content based on your preferences. A foundational overview of how to build a tabs component similar to those found in iOS and Android apps. Adam Argyle In this post I want to share thinking on building a Tabs component for the web that is responsive, supports multiple device inputs, and works across browsers. Try the [demo](https://gui-challenges.web.app/tabs/dist/). [Demo](https://gui-challenges.web.app/tabs/dist/) If you prefer video, here's a YouTube version of this post: Overview Tabs are a common component of design systems but can take many shapes and forms. First there were desktop tabs built on `` element, and now we have buttery mobile components that animate content based on physics properties. They're all trying to do the same thing: save space. Today, the essentials of a tabs user experience is a button navigation area which toggles the visibility of content in a display frame. Many different content areas share the same space, but are conditionally presented based on the button selected in the navigation. A collage of tab component web design styles from over the past 10 years Web Tactics All in all I found this component pretty straightforward to build, thanks to a few critical web platform features: `scroll-snap-points` for elegant swipe and keyboard interactions with appropriate scroll stop positions [Deep links](https://en.wikipedia.org/wiki/Deep_linking) via URL hashes for browser handled in-page scroll anchoring and sharing support Screen reader support with `` and `id="#hash"` element markup `prefers-reduced-motion` for enabling crossfade transitions and instant in-page scrolling The in-draft `@scroll-timeline` web feature for dynamically underlining and color changing the selected tab The HTML Fundamentally, the UX here is: click a link, have the URL represent the nested page state, and then see the content area update as the browser scrolls to the matching element. There are some structural content members in there: links and `:target`s. We need a list of links, which a `