Skip to content

feat(tabs): add alignment prop to control tab list positioning #277

Merged
H4ad merged 5 commits into
SigNoz:mainfrom
rinkydevi:fix/issue-273-add-alignment
Jun 5, 2026
Merged

feat(tabs): add alignment prop to control tab list positioning #277
H4ad merged 5 commits into
SigNoz:mainfrom
rinkydevi:fix/issue-273-add-alignment

Conversation

@rinkydevi
Copy link
Copy Markdown
Contributor

@rinkydevi rinkydevi commented Jun 4, 2026

Summary

Closes #273

Adds an alignment prop to both the composed Tabs and primitive
TabsList components, allowing consumers to control whether the tab list
aligns to the left (default), center, or right within its container.

Changes

  • New TabsAlignment = 'left' | 'center' | 'right' type, exported from
    the package
  • alignment prop added to TabsProps and TabsListProps
  • Primary variant — uses justify-content (center / flex-end) on
    the wrapper
  • Secondary variant — uses a flex spacer technique to push tabs to the
    correct position without breaking the bottom-border line
  • Both variants support alignment combined with tabBarLeftContent /
    tabBarRightContent

Storybook

A new Alignment story covers all six combinations (3 alignments × 2
variants), plus edge cases with extra bar content:

  • Primary left / center / right
  • Secondary left / center / right
  • Primary center + right content
  • Primary center + left and right content
  • Primary right + right content
  • Secondary center + right content
  • Secondary center + left and right content

Latest Evidence

Screen.Recording.2026-06-06.at.12.30.04.AM.mov

Test plan

  • Primary left (default) — tabs hug the left edge
  • Primary center — tabs are centered in the container
  • Primary right — tabs are flush to the right
  • Secondary center / right — bottom border renders correctly with
    spacer
  • Alignment + extra bar content renders without layout breakage
  • No regression on existing TabBarExtraContent stories

Copy link
Copy Markdown
Contributor

@H4ad H4ad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The secondary + center + extra content is not aligning on center.

Image

Also, let's add as maximum variants as possible, eg:

  • primary/secondary with all the aligments with variants of tab extra empty/left/right/both

This way, we can have the storybook as test for any bug we could introduce

@rinkydevi rinkydevi force-pushed the fix/issue-273-add-alignment branch from ba73fb3 to c21fc5e Compare June 5, 2026 17:13
Copy link
Copy Markdown
Contributor

@H4ad H4ad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stories looks good but the alignment of the buttons didn't follow what we initially decided when we introduced extra tab content:

Image

Decision at #274 (comment)

rinkydevi added 2 commits June 5, 2026 23:33
- Always render tab-spacer-left so right/center alignment works even
  when tabBarLeftContent is provided (previously spacer-left was omitted
  and flex-grow had nothing to target)
- Collapse spacer-left to zero-width for default left alignment + left
  content so left content remains flush against the tab list
- Simplify center alignment: rely on two equal flex:1 spacers (left +
  grow) instead of growing extra-content zones, matching the primary
  variant behaviour where the [tabs + adjacent content] group is centered
Copy link
Copy Markdown
Contributor

@H4ad H4ad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

@H4ad H4ad merged commit b6d64ed into SigNoz:main Jun 5, 2026
1 of 2 checks passed
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.

Tabs - Add prop to control alingment of the tabs

2 participants