{"id":5705,"date":"2021-04-21T17:08:41","date_gmt":"2021-04-21T14:08:41","guid":{"rendered":"https:\/\/flatlogic.com\/blog\/?p=5705"},"modified":"2024-03-18T00:22:06","modified_gmt":"2024-03-17T21:22:06","slug":"javascript-tabs-save-space-examples-of-tabbed-widgets","status":"publish","type":"post","link":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/","title":{"rendered":"JavaScript Tabs: Save Space! Examples of Tabbed Widgets"},"content":{"rendered":"<p>As an essential UI component of the site, it seems that tabs are taken for granted and don&#8217;t deserve close attention. However, thanks to tabs that resolve the question of data segmentation and organization, the site audience can easily choose the relevant data they need to explore. Plus, tabs make the website more interactive and responsive, adding clarity that enhances the user experience.<br><br>In our review of <a  data-ilj-link-preview=\"true\"  data-featured-image=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2019\/09\/top-articles-copy-600x450.png\"  data-excerpt=\"Here is our list of JS articles of 2019. We collected 17 posts with tricks and tips in JavaScript and its frameworks.\" href=\"https:\/\/flatlogic.com\/blog\/17-articles-of-september-2019-to-learn-javascript\/\">JavaScript<\/a> tabs, we cover the creation process and snippet selection, crucial for developers building web apps, emphasizing their role in enhancing <a href=\"https:\/\/flatlogic.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">business software&#8217;s <\/a>user interface and functionality.<\/p><h2 class=\"wp-block-heading\" id=\"one\"><strong>What is JavaScript tab?<\/strong><\/h2><p>A tab, in a nutshell, is a single content area\/component of a site design system (also called a tabbed widget) with multiple panels, each linked to a title\/header in the list. Tabs may vary in size and shape, and they make the website page more structured and easier to grasp. From the position of web developers, tabbed widgets is a collection of links or other HTML elements that can be visually represented in the form of buttons, a group of buttons, and in some other ways. In essence, they simply turn on the visibility of one content block while hiding others.<\/p><h2 class=\"wp-block-heading\" id=\"two\"><strong>Types of Tabs<\/strong>: <strong>Navigation Tabs and Modular Tabs<\/strong><\/h2><p>Frequently, the focused, currently-used tab is somehow highlighted or moved forward to the user. This way, tabs can be divided into <em>navigation tabs<\/em> and <em>modular tabs.<\/em> Navigation tabs work as a clickable space opening content in a new webpage. Modular tabs open further info within the same page.<\/p><p>Well, needless to say, each interface is designed to resemble the tabs at the top of traditional file folders, as viewed from inside a file cabinet. The main advantage of <em>modular tabs<\/em> is that they help to reflect the relevant data-optimized within the web page screen area without data cluttering and reduce the amount of info on the screen to that needed to be shown.&nbsp;<\/p><h2 class=\"wp-block-heading\" id=\"three\"><strong>Scrollable and Fixed Tabs<\/strong><\/h2><p>Additionally, tabs can be divided into scrollable and fixed. When a set of tabs cannot fit on the screen, use scrollable tabs. Scrollable tabs can use longer text labels and a larger number of tabs. They are best used for browsing on touch interfaces.<\/p><h2 class=\"wp-block-heading\" id=\"four\"><strong>Tab Structure<\/strong><\/h2><p>Tab components consist of the container (the frame), tab item, active\/inactive tab icon or text, tab indicator. Tabs control the UI region are displayed below them. Tabs can be joined with components like top app bars, or nested into components like cards and sheets. In this sample we have no clear tab indicator, but we&#8217;ve defined its place by number 2, the aim of the indicator is to show the state of the content within the tab item.&nbsp; <a href=\"https:\/\/flatlogic.com\/generator\"><img decoding=\"async\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding.png\" alt=\"Professional Vibe Coding\" class=\"banner-img lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 2560px; --smush-placeholder-aspect-ratio: 2560\/640;\" data-srcset=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding.png 2560w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-600x150.png 600w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-1024x256.png 1024w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-768x192.png 768w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-1536x384.png 1536w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/Introducing-professional-vibe-coding-2048x512.png 2048w\" data-sizes=\"auto\" data-original-sizes=\"(max-width: 2560px) 100vw, 2560px\"> <\/a><\/p><figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/picture-1024x664.png\" alt=\"Javascript Tabs\" class=\"wp-image-5777 lazyload\" width=\"840\" height=\"544\" data-srcset=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/picture-1024x664.png 1024w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/picture-600x389.png 600w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/picture-768x498.png 768w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/picture-1536x996.png 1536w, https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/picture.png 1798w\" data-sizes=\"auto\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 840px; --smush-placeholder-aspect-ratio: 840\/544;\" data-original-sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/figure><ol class=\"wp-block-list\"><li>Frame (Container)<\/li><li>Tab indicator (Active\/Inactive)<\/li><li>Text (Active\/Inactive)<\/li><li>Icon\/Label (Active\/Inactive)<\/li><li>Tab item<\/li><\/ol><h2 class=\"wp-block-heading\" id=\"five\"><strong>Common Problems Resolved by Tabs<\/strong><\/h2><ul class=\"wp-block-list\"><li>Organization of info and navigation of chunks of information between groups of different or related content or at the same level of site hierarchy<\/li><li>Easily customizable with the colors or type of content to match site branding<\/li><li>Faster orientation and management of the website data<\/li><\/ul><h2 class=\"wp-block-heading\" id=\"six\"><strong>Criteria to Evaluate a Good Tab Component<\/strong><\/h2><ul class=\"wp-block-list\"><li>User Experience\/ External Appeal<\/li><li>Documentation<\/li><li>Customization<\/li><li>Reusability<\/li><\/ul><h2 class=\"wp-block-heading\" id=\"seven\"><strong>Free Javascript Tabs Examples<\/strong><\/h2><p>Make use of our top 10 tab snippets to help you while building your site. Setting up these tab widgets is absolutely free.&nbsp;<\/p><h3 class=\"wp-block-heading\"><strong>1. Vanilla JavaScript Tabs<\/strong><\/h3><figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"600\" height=\"338\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-1.gif\" alt=\"Javascript Tabs\" class=\"wp-image-5706 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; --smush-placeholder-aspect-ratio: 600\/338;\" \/><\/figure><p>Simple Fast Vanilla JavaScript Tabs is an easy, maintainable vanilla JavaScript library for <a href='https:\/\/flatlogic.com\/services\/web-development'>web development<\/a>. This tabs snippet will help you build responsive vertical navigation. Vanilla Javascript Tabs are pretty darn simple to use. Vanilla Javascript tabs are supported by all modern browsers like Chrome, Firefox, Safari, Opera, and others. First off,&nbsp; you should add the JS vanilla-js-tabs.js and Stylesheet vanilla-js-tabs.css to the page.<\/p><p><a href=\"http:\/\/zoltantothcom.github.io\/vanilla-js-tabs\/\"><strong>Demo<br><\/strong><\/a><a href=\"https:\/\/github.com\/zoltantothcom\/vanilla-js-tabs\"><strong>GitHub<\/strong><\/a><\/p><h3 class=\"wp-block-heading\"><strong>2. Tabby Tabs<\/strong><\/h3><figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"600\" height=\"338\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-2-1.gif\" alt=\"\" data-id=\"5708\" class=\"wp-image-5708 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; --smush-placeholder-aspect-ratio: 600\/338;\" \/><\/figure><\/li><\/ul><\/figure><p><strong><a href=\"https:\/\/codepen.io\/Sarah_C\/pen\/NNBwWm\">Tabby tabs<\/a><\/strong> is another example of extremely lightweight and accessible vanilla JS toggle tabs. Compiled and production-ready code can be found in the <em><code>dist<\/code><\/em> directory. The <em><code>src<\/code><\/em> directory contains development code.<br><br><a href=\"https:\/\/codepen.io\/Sarah_C\/pen\/NNBwWm\"><strong>Demo<\/strong><\/a><\/p><h3 class=\"wp-block-heading\"><strong>3. Adaptive tabs<\/strong><\/h3><figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"600\" height=\"338\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-3.gif\" alt=\"\" data-id=\"5709\" class=\"wp-image-5709 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; --smush-placeholder-aspect-ratio: 600\/338;\" \/><\/figure><\/li><\/ul><\/figure><p><a href=\"https:\/\/codepen.io\/Lewitje\/pen\/doJRBX\">Adaptive Tabs<\/a> is a super useful snippet to build into your site page. These tabs are animated to the height of their content when being switched. Adaptive tabs are highly simple to use, and there&#8217;s no risk of a huge page jump when moving from a content-heavy tab to a smaller one.<br><br><a href=\"https:\/\/codepen.io\/Lewitje\/pen\/doJRBX\"><strong>Demo<\/strong><\/a><\/p><h3 class=\"wp-block-heading\"><strong>4.<\/strong> <strong>Mobile-first accordion to tabs by Chyno Deluxe<\/strong><\/h3><figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"600\" height=\"338\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-10.gif\" alt=\"\" data-id=\"5710\" class=\"wp-image-5710 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; --smush-placeholder-aspect-ratio: 600\/338;\" \/><\/figure><\/li><\/ul><\/figure><p>Responsive, Mobile first, drop-down accordion tabs is another simple tabbed widget for developers made with HTML, CSS (SCSS language), and JS. It works well with all modern browsers like Chrome, Edge, Firefox, Opera, Safari.<\/p><p><strong><a href=\"https:\/\/codepen.io\/ChynoDeluxe\/pen\/qemoLr\">Demo<\/a><\/strong><\/p><h3 class=\"wp-block-heading\"><strong>5. Simple Tab Designs<\/strong><\/h3><figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"600\" height=\"338\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-11.gif\" alt=\"\" data-id=\"5714\" class=\"wp-image-5714 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; --smush-placeholder-aspect-ratio: 600\/338;\" \/><\/figure><\/li><\/ul><\/figure><p>Simple tab design is not just a name, it&#8217;s as simple as possible in use. This tab component is built on a mix of CSS and JavaScript. The individual tab contents slide down &amp; out of view, almost like notecards. This whole tab feature gives a highly visual experience.<br><br><a href=\"https:\/\/codepen.io\/0zero4four\/pen\/PPjZzj\"><strong>Demo<\/strong><\/a><\/p><h3 class=\"wp-block-heading\"><strong>6. CSS Tabs<\/strong><\/h3><figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"600\" height=\"338\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker.gif\" alt=\"\" data-id=\"5715\" class=\"wp-image-5715 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; --smush-placeholder-aspect-ratio: 600\/338;\" \/><\/figure><\/li><\/ul><\/figure><p>CSS Tabs, by Ramnek Sinkh, are made with smooth scroll property. Without animations or transitions used for tabs switching, tabs transition is made through the scroll-behavior property and HTML id&#8217;s.<strong><br><br><\/strong><a href=\"https:\/\/codepen.io\/Ramnk7\/pen\/yWBWEe\"><strong>Demo<\/strong><\/a><\/p><h3 class=\"wp-block-heading\"><strong>7. MetroTab<\/strong><\/h3><figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-6 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"600\" height=\"338\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-2-2.gif\" alt=\"\" data-id=\"5739\" data-full-url=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-2-2.gif\" data-link=\"https:\/\/flatlogic.com\/blog\/?attachment_id=5739\" class=\"wp-image-5739 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; --smush-placeholder-aspect-ratio: 600\/338;\" \/><\/figure><\/li><\/ul><\/figure><p>Metro tabs use the M4Q library, and these tabs are<em> <\/em><a  data-ilj-link-preview=\"true\"  data-featured-image=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2019\/10\/Frame-8_1-1-600x450.png\"  data-excerpt=\"jQuery vs. JavaScript JavaScript Before we compare jQuery vs JavaScript, let&#039;s recall the basics. What is JavaScript used for? JavaScript allows websites to perform actions such as refreshing specific parts of a page without reloading the entire website, displaying pop-up messages, or introducing animations into 2D or 3D graphics. Overall, the main impact is on&hellip;\" href=\"https:\/\/flatlogic.com\/blog\/jquery-vs-javascript-why-we-removed-jquery-from-our-templates\/\">jQuery<\/a> free. MetroTab plugin lets you make horizontal tabs by adding class<em> <code>tabs<\/code><\/em> to list and attribute <em><code>data-role=\"tabs\"<\/code><\/em>. And, <em><code>bottom<\/code><\/em> tabs by setting add class on.<\/p><p><a href=\"https:\/\/metroui.org.ua\/tabs.html\"><strong>Demo<\/strong><\/a><\/p><h3 class=\"wp-block-heading\"><strong>8. Responsive Tabs\/Accordion in Vanilla JavaScript<\/strong><\/h3><figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-12.gif\" alt=\"Javascript Tabs\" class=\"wp-image-5725 lazyload\" width=\"835\" height=\"448\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 835px; --smush-placeholder-aspect-ratio: 835\/448;\" \/><\/figure><p><a href=\"https:\/\/www.cssscript.com\/responsive-tabs-accordion-vanilla\/\">Responsive Tabs\/Accordion<\/a> is a pure JavaScript plugin with accordions and tabs, aimed to generate mobile-friendly horizontal or vertical tabs from unordered HTML lists with a switchable option.<br><br><a href=\"https:\/\/www.cssscript.com\/demo\/responsive-tabs-accordion-vanilla\/\"><strong>Demo<\/strong><\/a><\/p><h3 class=\"wp-block-heading\"><strong>9. Material Design Vanilla Javascript Tabs<\/strong><\/h3><figure class=\"wp-block-gallery columns-1 is-cropped wp-block-gallery-7 is-layout-flex wp-block-gallery-is-layout-flex\"><ul class=\"blocks-gallery-grid\"><li class=\"blocks-gallery-item\"><figure><img decoding=\"async\" width=\"600\" height=\"338\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-4-1.gif\" alt=\"\" data-id=\"5717\" class=\"wp-image-5717 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; --smush-placeholder-aspect-ratio: 600\/338;\" \/><\/figure><\/li><\/ul><\/figure><p>Material design<strong> <\/strong>is loved by thousands of people.<strong> <\/strong>Vanilla JavaScript tabs are one more neat snippet for coders. These tabs are made with pure Javascript, CSS and CSS3. For more illustrative examples of <a href=\"https:\/\/material.io\/components\/tabs\">material design tabs<\/a>, refer to this detailed guide.<strong><br><br><\/strong><a href=\"https:\/\/codepen.io\/LukyVj\/pen\/yNwgrK\"><strong>Demo<\/strong><\/a><\/p><h3 class=\"wp-block-heading\"><strong>10. Gettin&#8217; Practical with Tabs &#8211; Vue Challenge by Jack Domleo<\/strong><\/h3><figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"600\" height=\"338\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-8-2.gif\" alt=\"Gettin' Practical with Tabs\n\" class=\"wp-image-5723 lazyload\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 600px; --smush-placeholder-aspect-ratio: 600\/338;\" \/><\/figure><p><a href=\"https:\/\/codepen.io\/jackdomleo7\/pen\/qBOKaeK\">Gettin&#8217; Practical<\/a> is for the lovers of minimalistic design. Well-ordered approach makes the tabs look extremely clean. They work in Chrome, Safari, Firefox, Opera, and Edge. This UI component allows Vue.js tab switching.<br><br><a href=\"https:\/\/codepen.io\/jackdomleo7\/pen\/qBOKaeK\"><strong>Demo<\/strong><\/a><\/p><h3 class=\"wp-block-heading\"><strong>11. Tabs with elastic border<\/strong><\/h3><figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" data-src=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/ezgif.com-gif-maker-5-1.gif\" alt=\"tabs with elastic borders\n\" class=\"wp-image-5724 lazyload\" width=\"621\" height=\"350\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 621px; --smush-placeholder-aspect-ratio: 621\/350;\" \/><\/figure><p><a href=\"https:\/\/www.uplabs.com\/posts\/tabs-with-elastic-border\">Tabs with elastic border<\/a> is one more variant to use for tabs option. The code is represented in HTML, CSS and Javascript (Babel). The structure of the code is well-organized and the tabbed widget looks really modern.<br><br><a href=\"https:\/\/codepen.io\/iremlopsum\/pen\/aqvKJL\"><strong>Demo<\/strong><\/a><\/p><h3 class=\"wp-block-heading\" id=\"eight\"><strong>How to Use Js tabs?<\/strong><\/h3><p>Implement the following functions which allow you to create and toggle the tabs on your website step-by-step according to this <a href=\"https:\/\/rudrastyh.com\/javascript\/tabs.html\">guide<\/a>.<\/p><h3 class=\"wp-block-heading\" id=\"nine\"><strong>How to Make a Switchable Tab on Your Page?<\/strong><\/h3><p>To make the tabs toggleable, add the <em><code>data-toggle=\"tab\"<\/code><\/em> attribute to each link. Then add a .tab-pane class with a unique ID for every tab and wrap them inside a div element with class <code>.tab-content<\/code>.<br><br>You can also activate the tabs by writing the Javascript code. Then you do not need to add the <code>data-toggle=\"tab\"<\/code> attribute.&nbsp;<\/p><p>Displaying the tab, in this case, will be done by calling the tab (&#8216;show&#8217;) method. This method should be used for the relevant tab (link) every time the user clicks on it.<\/p><h3 class=\"wp-block-heading\"><strong>Source JS code:<\/strong><\/h3><ul class=\"wp-block-list\"><li>The source JavaScript code consists of&nbsp; <code>$<em>tab. function<\/em><\/code>. There will be <code>_<em>elemTabs<\/em><\/code> and functions <code>_<em>showTab<\/em><\/code>, <code>_<em>switchTabTo<\/em><\/code>. Inside this function there is a variable <code>_<em>elemTabs<\/em><\/code><em> <\/em>and functions <code>_<em>showTab<\/em><\/code>, <code>_s<em>witchTabTo<\/em><\/code>. A variable <code>_elemTabs<\/code> has a DOM-element, it looks like a container with tabs.<\/li><li><code>_<em>showTab<\/em><\/code> is made to hide the active tab and display the other tab based on the transferred link.&nbsp; <code>_<em>switchTabTo<\/em><\/code> method is used to switch the tab by number. addEventListener is set by event handlers.<\/li><li>_showTab and _switchTabTo are the only methods available out of the function. showTab lets you go to the tab by transferring the link on DOM-element, and the second one (<code>switchTabTo<\/code>) opens up the page by its page number.<\/li><\/ul><h3 class=\"wp-block-heading\" id=\"ten\"><strong>Wrapping Up<\/strong><\/h3><p>We&#8217;ve explained what a tab is and how to use a tab component for building interactive websites and mobile apps with pure JavaScript. If you need to know more about other UI elements and components, pay attention to the related articles.<\/p><h3 class=\"wp-block-heading\" id=\"eleven\"><strong>About Flatlogic<\/strong><\/h3><p><a href=\"https:\/\/flatlogic.com\">Flatlogic<\/a> is a small group of people, full of enthusiasm to make the world more beautiful and functional. We do our best to create beautifully designed web &amp; mobile application <a href=\"https:\/\/flatlogic.com\/templates\/react\">templates built with React,<\/a> React Native, Vue, Angular, and Bootstrap to create modern apps and speed up development. We strive to run our business openly, hand-in-hand with all our business partners to create commercially efficient relationships that never compromise on the quality of the result.<\/p><h3 class=\"wp-block-heading\">Related Articles<\/h3><ul class=\"wp-block-list\" id=\"block-0a5e1428-baec-4bcc-8608-11de36ee64d4\"><li><a href=\"https:\/\/flatlogic.com\/blog\/13-bootstrap-date-pickers-examples\/\"><strong>13+ Bootstrap 4 Date Picker Examples<\/strong><\/a><\/li><li><a href=\"https:\/\/flatlogic.com\/blog\/top-icons-packs-and-resources-for-web\/\"><strong>20+ Best Premium And Free Icon Packs For Web Developers And Designers<\/strong><\/a><\/li><li><a href=\"https:\/\/flatlogic.com\/blog\/top-javascript-calendar-plugins\/\"><strong>Top JavaScript Calendar Plugins<\/strong><\/a><\/li><li><a href=\"https:\/\/flatlogic.com\/blog\/top-mistakes-javascript-developers-make\/\"><strong>Top Mistakes Every Javascript Developer Makes<\/strong><\/a><\/li><\/ul>","protected":false},"excerpt":{"rendered":"<p>A tab is a single content area\/component of a site design system (also called a tabbed widget) with multiple panels, each linked to a title\/header in the list. Tabs may vary in size and shape, and they make the website page more structured and easier to grasp. <\/p>\n","protected":false},"author":16,"featured_media":11616,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"flatlogic_tldr":"Explains JS tabs and how they segment content to improve UX; navigation vs modular, scrollable vs fixed\nOutlines tab structure and criteria for quality (UX, docs, customization, reusability)\nCurates 11 free tab snippets (vanilla JS\/CSS\/Vue) with demos for fast integration\nGuides implementing switchable tabs via data attributes or pure JavaScript functions","flatlogic_facts":[{"text":"Tabs are divided into navigation tabs (open new page) and modular tabs (show content on the same page).","source":""},{"text":"Scrollable tabs are best when tabs overflow the screen, especially on touch interfaces.","source":""},{"text":"Tab components include frame, tab indicator, text, icon\/label, and tab item.","source":""},{"text":"MetroTab uses the M4Q library and is jQuery-free.","source":"https:\/\/metroui.org.ua\/tabs.html"},{"text":"Responsive Tabs\/Accordion is a pure JS plugin creating mobile-friendly horizontal or vertical tabs.","source":"https:\/\/www.cssscript.com\/responsive-tabs-accordion-vanilla\/"}],"footnotes":""},"categories":[40],"tags":[283,474,54,532],"class_list":["post-5705","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-reviews","tag-data-visualization","tag-frontend-development","tag-javascript","tag-ui-components"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.2 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JavaScript Tabs: Save Space! Examples of Tabbed Widgets - Flatlogic Blog<\/title>\n<meta name=\"description\" content=\"Check the range of Javascript tabs examples and how to make toggleable tabs on site. Learn the difference between modular nd navigation tabs.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JavaScript Tabs: Save Space! Examples of Tabbed Widgets\" \/>\n<meta property=\"og:description\" content=\"Check the range of Javascript tabs examples and how to make toggleable tabs on site. Learn the difference between modular nd navigation tabs.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/\" \/>\n<meta property=\"og:site_name\" content=\"Flatlogic Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/flatlogic\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/katarina.harbuzava\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-04-21T14:08:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-03-17T21:22:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/Best-React-IDEs-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1080\" \/>\n\t<meta property=\"og:image:height\" content=\"1080\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Katarina Harbuzava\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/katrinblanchare\" \/>\n<meta name=\"twitter:site\" content=\"@flatlogic\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Katarina Harbuzava\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JavaScript Tabs: Save Space! Examples of Tabbed Widgets - Flatlogic Blog","description":"Check the range of Javascript tabs examples and how to make toggleable tabs on site. Learn the difference between modular nd navigation tabs.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/","og_locale":"en_US","og_type":"article","og_title":"JavaScript Tabs: Save Space! Examples of Tabbed Widgets","og_description":"Check the range of Javascript tabs examples and how to make toggleable tabs on site. Learn the difference between modular nd navigation tabs.","og_url":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/","og_site_name":"Flatlogic Blog","article_publisher":"https:\/\/www.facebook.com\/flatlogic","article_author":"https:\/\/www.facebook.com\/katarina.harbuzava\/","article_published_time":"2021-04-21T14:08:41+00:00","article_modified_time":"2024-03-17T21:22:06+00:00","og_image":[{"width":1080,"height":1080,"url":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/Best-React-IDEs-1.png","type":"image\/png"}],"author":"Katarina Harbuzava","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/katrinblanchare","twitter_site":"@flatlogic","twitter_misc":{"Written by":"Katarina Harbuzava","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/#article","isPartOf":{"@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/"},"author":{"name":"Katarina Harbuzava","@id":"https:\/\/flatlogic.com\/blog\/#\/schema\/person\/e0181c5edc04022ba61f5cf9111d37bd"},"headline":"JavaScript Tabs: Save Space! Examples of Tabbed Widgets","datePublished":"2021-04-21T14:08:41+00:00","dateModified":"2024-03-17T21:22:06+00:00","mainEntityOfPage":{"@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/"},"wordCount":1434,"publisher":{"@id":"https:\/\/flatlogic.com\/blog\/#organization"},"image":{"@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/#primaryimage"},"thumbnailUrl":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/Best-React-IDEs-1.png","keywords":["Data Visualization","Frontend Development","Javascript","UI Components"],"articleSection":["Reviews"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/","url":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/","name":"JavaScript Tabs: Save Space! Examples of Tabbed Widgets - Flatlogic Blog","isPartOf":{"@id":"https:\/\/flatlogic.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/#primaryimage"},"image":{"@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/#primaryimage"},"thumbnailUrl":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/Best-React-IDEs-1.png","datePublished":"2021-04-21T14:08:41+00:00","dateModified":"2024-03-17T21:22:06+00:00","description":"Check the range of Javascript tabs examples and how to make toggleable tabs on site. Learn the difference between modular nd navigation tabs.","breadcrumb":{"@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/#primaryimage","url":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/Best-React-IDEs-1.png","contentUrl":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2021\/04\/Best-React-IDEs-1.png","width":1080,"height":1080,"caption":"javascript tabs"},{"@type":"BreadcrumbList","@id":"https:\/\/flatlogic.com\/blog\/javascript-tabs-save-space-examples-of-tabbed-widgets\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/flatlogic.com\/blog\/"},{"@type":"ListItem","position":2,"name":"JavaScript Tabs: Save Space! Examples of Tabbed Widgets"}]},{"@type":"WebSite","@id":"https:\/\/flatlogic.com\/blog\/#website","url":"https:\/\/flatlogic.com\/blog\/","name":"Flatlogic Blog","description":"Vibe-coding, AI Agents, Professional Software Development Services, Case Studies and More","publisher":{"@id":"https:\/\/flatlogic.com\/blog\/#organization"},"alternateName":"Flatlogic Blog","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/flatlogic.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/flatlogic.com\/blog\/#organization","name":"Flatlogic","url":"https:\/\/flatlogic.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/flatlogic.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/62ea6de0b3469aa3d6ebb528-1.png","contentUrl":"https:\/\/flatlogic.com\/blog\/wp-content\/uploads\/2025\/10\/62ea6de0b3469aa3d6ebb528-1.png","width":970,"height":257,"caption":"Flatlogic"},"image":{"@id":"https:\/\/flatlogic.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/flatlogic","https:\/\/x.com\/flatlogic","https:\/\/www.instagram.com\/flatlogiccom\/","https:\/\/www.linkedin.com\/company\/flatlogic\/"]},{"@type":"Person","@id":"https:\/\/flatlogic.com\/blog\/#\/schema\/person\/e0181c5edc04022ba61f5cf9111d37bd","name":"Katarina Harbuzava","sameAs":["https:\/\/www.facebook.com\/katarina.harbuzava\/","https:\/\/www.instagram.com\/katarina.harbuzava\/","https:\/\/www.linkedin.com\/in\/katarina-harbuzava-698a49126\/","https:\/\/x.com\/https:\/\/twitter.com\/katrinblanchare","https:\/\/www.youtube.com\/channel\/UCDbyjsN_OkJfKTmg2qN-D2Q","https:\/\/soundcloud.com\/katarinaharbuzawa","Working in the sphere of digital, Katarina is a passionate author, writer, editor, content manager and chief vibe curator. Previously working in one of the largest east European concert agencies, Katarina is an avid ambassador of culture, esthetic education, and all the creative stuff. She adores music and musical instruments. She holds a university degree in modern linguistics, in the field of teaching English, German and Swedish. She stays on top of all social media trends and recently switched to the theme of web design, delving deeper into Figma and learning the basics of front end development. When Katya is not watching tutorials or live gigs on YouTube, you can see her cuddling large fluffy dogs; or buying a ticket to a new place, because she is just obsessed with new routes and adventures! She stays forever inspired by people, new cities, stations and airports, and is convinced that travelling is the only true way to discover, gain new experiences and make the world an even better place to live in."],"url":"https:\/\/flatlogic.com\/blog\/author\/katarina\/"}]}},"_links":{"self":[{"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/posts\/5705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/comments?post=5705"}],"version-history":[{"count":55,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/posts\/5705\/revisions"}],"predecessor-version":[{"id":15392,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/posts\/5705\/revisions\/15392"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/media\/11616"}],"wp:attachment":[{"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/media?parent=5705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/categories?post=5705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/flatlogic.com\/blog\/wp-json\/wp\/v2\/tags?post=5705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}