Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Responsive tabs on desktop #981

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Responsive tabs on desktop #981

wants to merge 10 commits into from

Conversation

dani-moreno
Copy link
Collaborator

@dani-moreno dani-moreno commented Dec 17, 2024

Description

This PR updates the Tabs component to be responsive. It handles overflow by moving excess tabs into a dropdown menu when there isn't enough space to display all tabs horizontally.

Features

  • Shows all tabs on mobile (they can be scrolled horizontally)
  • On desktop (md breakpoint and above), implements an overflow logic (as scrolling horizontally is not a common gesture in desktop)
  • Uses a "More" dropdown when tabs don't fit in the container

Tab visibility logic

The important part of this PR is this logic. This is how it works:

  1. Width calculation
  • Measures the tab widths once
  • Caches measurements
  • Calculates available space by subtracting "More" button and padding from container width
  1. Tab display
  • Visible tabs are rendered directly in the navigation
  • Overflow tabs are placed in a dropdown menu
  • Updates layout only when necessary

Screenshots

Screen.Recording.2024-12-17.at.11.13.08.mov

Type of Change

  • New experimental component
  • Promote component from experimental to stable
  • Maintenance / Bug Fix / Other

Copy link

github-actions bot commented Dec 17, 2024

🔍 Visual review for your branch is published 🔍

Here are the links to:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant