Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mini Challenge #03 — Interactive Tabs & Content Switcher

A focused frontend mini challenge built around a common interface pattern: switching between related content without leaving the current page.

The challenge focuses on interaction design, active states, keyboard navigation, accessibility, responsive layout, and purposeful animation.

Rather than building a large application, this project keeps the scope intentionally small and concentrates on getting one UI interaction right.


Project Overview

The Interactive Tabs & Content Switcher is a responsive interface that allows users to switch between three workspace sections:

  • Overview
  • Activity
  • Preferences

Each tab displays a different content panel while keeping the user in the same context.

The interface includes an animated tab indicator, content transition, keyboard navigation, accessible tab semantics, responsive behavior, and interactive preference switches.


Main Focus

This mini challenge focuses on:

  • Interactive tabs
  • DOM manipulation
  • Active UI states
  • Content switching
  • CSS transitions
  • Micro-interactions
  • Keyboard navigation
  • Accessibility
  • Responsive design
  • Semantic HTML
  • Vanilla JavaScript

The goal is to understand how a reusable UI interaction is structured and implemented.


Screenshot

Interactive Tabs 1 Interactive Tabs 2 Interactive Tabs 3


Challenge Goals

The main goals of this challenge were:

  1. Build a functional tab component.
  2. Switch content without reloading the page.
  3. Create a clear active tab state.
  4. Animate the tab indicator.
  5. Animate newly displayed content.
  6. Practice DOM manipulation.
  7. Practice data-* attributes.
  8. Implement keyboard tab navigation.
  9. Practice accessible ARIA tab patterns.
  10. Create responsive behavior.
  11. Use animation to communicate a state change.
  12. Keep the UI visually simple and focused.

Technologies Used

HTML5

Used for:

  • Semantic structure
  • Buttons
  • Sections
  • Articles
  • Lists
  • Labels
  • Accessibility attributes
  • Tab and tab-panel semantics

CSS3

Used for:

  • Layout
  • Custom properties
  • Responsive design
  • Active states
  • Hover states
  • Focus states
  • Transitions
  • Animations
  • Custom switches
  • Reduced-motion support

Bootstrap 5

Used for:

  • Supporting frontend structure
  • Responsive utilities
  • Bootstrap Icons

The primary visual styling is handled through custom CSS.

Vanilla JavaScript

Used for:

  • Tab switching
  • DOM manipulation
  • Active states
  • Content visibility
  • Keyboard navigation
  • Indicator movement
  • Accessibility updates

Google Fonts

DM Sans is used for interface typography.


Project Structure

mini-interactive-tabs/
│
├── index.html
├── style.css
├── script.js
│
├── assets/
│   └── images/
│       └── screenshot.jpeg
│
└── README.md

Features

1. Interactive Tabs

The interface contains three sections:

Overview
Activity
Preferences

Clicking a tab changes the displayed content without refreshing the page.


2. Animated Active Indicator

The selected tab has a subtle white indicator behind it.

When the user changes tabs, the indicator moves horizontally to the new position.

This creates a clear connection between:

selected navigation → selected content


3. Animated Content Switching

New content enters with a short vertical fade animation.

The animation is intentionally subtle so the interaction remains fast and easy to understand.


4. Overview Panel

The Overview section provides a small workspace summary containing:

  • Active projects
  • Tasks this week
  • Last activity

A supporting action allows the user to continue into the workspace.


5. Activity Panel

The Activity section shows recent workspace changes.

Each activity contains:

  • Activity marker
  • Description
  • Relative time

This provides a simple example of a chronological activity pattern.


6. Preferences Panel

The Preferences section demonstrates interactive switches.

The example preferences include:

  • Email notifications
  • Weekly summary

The switches are implemented with native checkbox inputs and custom CSS styling.


7. Keyboard Navigation

The tabs support keyboard interaction.

Supported keys include:

Arrow Right
Arrow Left
Home
End

This allows users to move through the tab interface without relying on a mouse.


8. Accessible Tab Structure

The component uses ARIA attributes including:

role="tablist"
role="tab"
role="tabpanel"
aria-selected
aria-controls
aria-labelledby

Only the active tab remains in the normal keyboard tab order.


9. Responsive Design

The interface adapts to:

  • Desktop
  • Tablet
  • Mobile
  • Small mobile screens

The component maintains readable spacing and typography across different viewport sizes.


10. Focus States

Interactive elements include visible keyboard focus states.

This helps users understand where keyboard focus currently exists.


11. Reduced Motion

The interface respects:

prefers-reduced-motion

When reduced motion is enabled, animations and transitions are minimized.


Design Approach

The design intentionally avoids excessive visual decoration.

Instead of using:

  • Large gradients
  • Glassmorphism
  • Floating shapes
  • Heavy shadows
  • Excessive rounded cards
  • Decorative animation

the interface focuses on:

Hierarchy
    ↓
Clarity
    ↓
State
    ↓
Feedback
    ↓
Interaction

The main component is kept visually quiet so the tab interaction becomes the primary focus.


Interaction Flow

The interaction follows this pattern:

User selects a tab
        ↓
Active tab state changes
        ↓
Indicator moves
        ↓
Corresponding panel becomes visible
        ↓
New content fades upward
        ↓
User understands the new section

This creates a direct relationship between navigation and content.


Animation Approach

Animations were intentionally kept small.

Tab Indicator

The active indicator slides between tabs.

Panel Entrance

The newly selected panel enters with a short fade and vertical movement.

Action Buttons

Action buttons move slightly on hover.

Preference Switch

The switch thumb moves smoothly when its state changes.

Reduced Motion

When the user prefers reduced motion, unnecessary animations are minimized.

The goal is:

motion that communicates change, not motion for decoration.


JavaScript

The tab component is controlled using Vanilla JavaScript.

The main function is:

activateTab(index);

It handles:

  • Active tab state
  • aria-selected
  • tabindex
  • Indicator position
  • Panel visibility
  • Keyboard focus

The tab name is stored using a data-tab attribute.

Example:

data-tab="overview"

This allows JavaScript to identify the corresponding content panel.


Accessibility

Accessibility considerations include:

  • Semantic buttons
  • ARIA tab roles
  • aria-selected
  • aria-controls
  • aria-labelledby
  • Keyboard navigation
  • Roving tabindex
  • Visible focus states
  • Native checkbox controls
  • Reduced-motion support

The interaction is designed to remain usable without relying entirely on pointer input.


How to Run Locally

1. Clone the repository

git clone https://github.com/codingwithvignesh/mini-interactive-tabs.git

2. Open the project

cd mini-interactive-tabs

3. Open index.html

Open the file directly in your browser.

For development, VS Code with Live Server can also be used.


What I Practiced

Through this mini challenge, I practiced:

  • HTML5 semantic structure
  • Interactive tabs
  • Content switching
  • DOM manipulation
  • data-* attributes
  • CSS transitions
  • CSS animations
  • Active states
  • Hover states
  • Focus states
  • Keyboard navigation
  • ARIA attributes
  • Responsive design
  • Custom switches
  • Vanilla JavaScript
  • UI state management
  • Micro-interactions
  • Reduced-motion support

Development Workflow

Step 1 — Structure

Created the tab navigation and three content panels using HTML5.

Focused on:

  • Semantic structure
  • Navigation hierarchy
  • Content organization
  • Accessibility attributes

Step 2 — Styling

Created the visual interface using CSS.

Focused on:

  • Typography
  • Spacing
  • Borders
  • Active states
  • Responsive behavior
  • Focus states

Step 3 — Interaction

Added JavaScript for:

  • Tab switching
  • Panel visibility
  • Active states
  • Indicator movement
  • Keyboard navigation

Step 4 — Animation

Added small animations to communicate:

  • Tab changes
  • Content changes
  • Hover interactions
  • Switch state changes

Step 5 — Testing

Tested the component across:

  • Desktop
  • Tablet
  • Mobile
  • Keyboard navigation
  • Reduced-motion settings

Testing Checklist

Tabs

  • Overview tab works.
  • Activity tab works.
  • Preferences tab works.
  • Only one panel is visible at a time.
  • Active tab is visually clear.
  • Indicator moves correctly.

Animation

  • Tab indicator animates.
  • New content enters smoothly.
  • Button hover interaction works.
  • Switch animation works.
  • Reduced-motion preference works.

Keyboard

  • Arrow Right changes tab.
  • Arrow Left changes tab.
  • Home moves to first tab.
  • End moves to last tab.
  • Focus is visible.

Accessibility

  • Tabs have correct ARIA attributes.
  • Panels have correct relationships.
  • Active tab has aria-selected="true".
  • Inactive tabs have aria-selected="false".
  • Keyboard navigation works.

Responsive

  • Desktop layout works.
  • Tablet layout works.
  • Mobile layout works.
  • Small mobile layout works.
  • Text remains readable.
  • Buttons remain accessible.

Future Improvements

Possible improvements for a future version include:

  • URL hash support for individual tabs
  • Swipe navigation on mobile
  • Tab persistence using localStorage
  • More complex reusable tab configuration
  • Automated accessibility testing
  • Component extraction into a reusable JavaScript module

These improvements are intentionally outside the current mini challenge.

The current goal is to master the core tab interaction first.


Browser Support

The project is designed for modern browsers supporting:

  • HTML5
  • CSS3
  • JavaScript ES6+
  • CSS custom properties
  • CSS animations
  • ARIA attributes

Recommended browsers:

  • Google Chrome
  • Microsoft Edge
  • Mozilla Firefox
  • Safari

Author

Vignesh Govindaraj

UI/UX Designer • Front-End Developer

Portfolio

https://vigneshux.netlify.app/

GitHub

https://github.com/codingwithvignesh

Behance

https://www.behance.net/vigneshgovindaraj


HTML, CSS & JavaScript Challenge

This project is part of my frontend mini challenge series.

The purpose of these challenges is to build small interfaces and interactions consistently instead of immediately jumping into large applications.

The learning pattern is:

HTML
  ↓
CSS
  ↓
JavaScript
  ↓
Interactive UI

The project pattern is:

STRUCTURE
    •
STYLE
    •
INTERACTION

This challenge specifically focuses on:

Interactive Navigation • UI States • DOM Manipulation • Accessibility • Animation


Personal GitHub Topic

Projects in this challenge series use my personal GitHub topic:

vignesh-builds

This identifies projects that I personally build as part of my UI/UX and frontend development practice.


License

This project is created for educational and personal portfolio purposes.

You are welcome to explore the code and use the ideas for learning.


Built with HTML5, CSS3, Bootstrap 5, and Vanilla JavaScript.

About

A responsive interactive tabs component built with HTML5, CSS3, Bootstrap 5, and Vanilla JavaScript. Features animated content switching, active states, keyboard navigation, accessible tab controls, and responsive UI design.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages