Skip to content

feat (tabs): add variants and sizes#726

Open
paanSinghCoder wants to merge 2 commits intomainfrom
feat/tabs-design-improvement
Open

feat (tabs): add variants and sizes#726
paanSinghCoder wants to merge 2 commits intomainfrom
feat/tabs-design-improvement

Conversation

@paanSinghCoder
Copy link
Copy Markdown
Contributor

Description

feat: introduce size (small, medium and large) and variant (segmented, standalone and plain) props.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor (no functional changes, no bug fixes just code improvements)
  • Chore (changes to the build process or auxiliary tools and libraries such as documentation generation)
  • Style (changes that do not affect the meaning of the code (white-space, formatting, etc))
  • Test (adding missing tests or correcting existing tests)
  • Improvement (Improvements to existing code)
  • Other (please specify)

How Has This Been Tested?

[Describe the tests that you ran to verify your changes]

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation (.mdx files)
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Screenshots (if appropriate):

[Add screenshots here]

Related Issues

[Link any related issues here using #issue-number]

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview, Comment Mar 31, 2026 3:50am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 31, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 088b958c-7b3c-4a8d-a634-82734534b7ef

📥 Commits

Reviewing files that changed from the base of the PR and between a9d2de8 and 622dd46.

📒 Files selected for processing (1)
  • apps/www/src/content/docs/components/tabs/demo.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/www/src/content/docs/components/tabs/demo.ts

📝 Walkthrough

Walkthrough

This pull request adds visual variant and size support to the Tabs component. TabsRoot now accepts variant?: 'segmented' | 'standalone' | 'plain' and size?: 'small' | 'medium' | 'large' props (and its displayName changed to Tabs.Root). CSS module updates introduce custom properties and classes for variant and size styling; the trigger/indicator styles and disabled behavior were adjusted. Demo examples for variants and sizes were added to the docs, and tests were introduced to assert variant and size class behavior.

Possibly related issues

Suggested reviewers

  • ravisuhag
  • rohilsurana
  • rsbh
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat (tabs): add variants and sizes' clearly and concisely describes the main feature addition—introducing variant and size props to the Tabs component.
Description check ✅ Passed The description is directly related to the changeset, explaining the feature addition of size and variant props with their supported values.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/www/src/content/docs/components/tabs/demo.ts (1)

6-27: ⚠️ Potential issue | 🟠 Major

Preview demo has mismatched defaultValue and trigger values.

The preview sets defaultValue="tab-one" but no Tabs.Tab exists for tab-one, and it also includes content entries without corresponding triggers.

💡 Suggested fix
-  <Tabs defaultValue="tab-one">
+  <Tabs defaultValue="tab-two">
@@
-      <Tabs.Content value="tab-one">
-        <Text>General settings content</Text>
-      </Tabs.Content>
       <Tabs.Content value="tab-two">
         <Text>Hosting configuration content</Text>
       </Tabs.Content>
-      <Tabs.Content value="tab-three">
-        <Text>Editor preferences content</Text>
-      </Tabs.Content>
       <Tabs.Content value="tab-four">
         <Text>Billing information content</Text>
       </Tabs.Content>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/www/src/content/docs/components/tabs/demo.ts` around lines 6 - 27, The
Tabs demo has mismatched values: the Tabs component sets defaultValue="tab-one"
but there is no Tabs.Tab with value "tab-one", and several Tabs.Content entries
(e.g., values "tab-one" and "tab-three") lack corresponding Tabs.Tab triggers;
update the Tabs.List to include Tabs.Tab elements matching every Tabs.Content
value or remove/rename the orphaned Tabs.Content values to match existing
Tabs.Tab triggers (ensure defaultValue matches an existing Tabs.Tab value),
referencing the Tabs component, its defaultValue prop, Tabs.List / Tabs.Tab
entries, and Tabs.Content value attributes when making the changes.
🧹 Nitpick comments (2)
packages/raystack/components/tabs/__tests__/tabs.test.tsx (1)

321-353: Add a size="medium" assertion to complete size coverage.

medium is part of the new public API but is not validated in this suite.

💡 Suggested test addition
   describe('Sizes', () => {
@@
     it('applies small size class', () => {
@@
       expect(root).toHaveClass(styles['size-small']);
     });
+
+    it('applies medium size class', () => {
+      render(
+        <Tabs defaultValue='tab1' size='medium'>
+          <Tabs.List>
+            <Tabs.Tab value='tab1'>{TAB_1_TEXT}</Tabs.Tab>
+          </Tabs.List>
+          <Tabs.Content value='tab1'>{CONTENT_1_TEXT}</Tabs.Content>
+        </Tabs>
+      );
+
+      const tablist = screen.getByRole('tablist');
+      const root = tablist.closest(`.${styles.root}`);
+      expect(root).not.toBeNull();
+      expect(root).toHaveClass(styles['size-medium']);
+    });
   });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/raystack/components/tabs/__tests__/tabs.test.tsx` around lines 321 -
353, Add a new test in the "Sizes" suite that renders <Tabs defaultValue='tab1'
size='medium'> with a Tabs.List/Tabs.Tab and Tabs.Content (same pattern as the
existing tests), query the tablist via screen.getByRole('tablist'), find its
closest element with styles.root, assert it's not null, and assert it has the
class styles['size-medium'] to validate the medium size option for the Tabs
component.
packages/raystack/components/tabs/tabs.module.css (1)

77-79: Disabled trigger should not keep pointer cursor.

Disabled tabs still look clickable because .trigger sets cursor: pointer and the disabled override only changes opacity.

💡 Suggested fix
 .trigger[data-disabled] {
   opacity: 0.5;
+  cursor: not-allowed;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/raystack/components/tabs/tabs.module.css` around lines 77 - 79, The
disabled tab rule (.trigger[data-disabled]) only sets opacity, leaving the
pointer cursor from .trigger intact; update the .trigger[data-disabled] selector
to override the cursor (e.g., cursor: default or cursor: not-allowed) so
disabled triggers no longer appear clickable and ensure the disabled selector
appears after the base .trigger rule so it takes precedence.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/raystack/components/tabs/tabs.module.css`:
- Around line 12-26: TabsRoot maps size="large" and variant="segmented" (and
other defaults) to CSS-module keys that don't exist in tabs.module.css, creating
a contract gap; add the missing modifier classes (.size-large,
.variant-segmented and any other referenced but undefined modifier classes) to
tabs.module.css and define the same CSS custom properties/values as the existing
size/variant classes (or appropriate defaults) so the class names used by
TabsRoot match actual stylesheet keys.

---

Outside diff comments:
In `@apps/www/src/content/docs/components/tabs/demo.ts`:
- Around line 6-27: The Tabs demo has mismatched values: the Tabs component sets
defaultValue="tab-one" but there is no Tabs.Tab with value "tab-one", and
several Tabs.Content entries (e.g., values "tab-one" and "tab-three") lack
corresponding Tabs.Tab triggers; update the Tabs.List to include Tabs.Tab
elements matching every Tabs.Content value or remove/rename the orphaned
Tabs.Content values to match existing Tabs.Tab triggers (ensure defaultValue
matches an existing Tabs.Tab value), referencing the Tabs component, its
defaultValue prop, Tabs.List / Tabs.Tab entries, and Tabs.Content value
attributes when making the changes.

---

Nitpick comments:
In `@packages/raystack/components/tabs/__tests__/tabs.test.tsx`:
- Around line 321-353: Add a new test in the "Sizes" suite that renders <Tabs
defaultValue='tab1' size='medium'> with a Tabs.List/Tabs.Tab and Tabs.Content
(same pattern as the existing tests), query the tablist via
screen.getByRole('tablist'), find its closest element with styles.root, assert
it's not null, and assert it has the class styles['size-medium'] to validate the
medium size option for the Tabs component.

In `@packages/raystack/components/tabs/tabs.module.css`:
- Around line 77-79: The disabled tab rule (.trigger[data-disabled]) only sets
opacity, leaving the pointer cursor from .trigger intact; update the
.trigger[data-disabled] selector to override the cursor (e.g., cursor: default
or cursor: not-allowed) so disabled triggers no longer appear clickable and
ensure the disabled selector appears after the base .trigger rule so it takes
precedence.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 28a946e5-eb1a-42a2-a62b-020341598fa6

📥 Commits

Reviewing files that changed from the base of the PR and between e741c21 and a9d2de8.

📒 Files selected for processing (6)
  • apps/www/src/content/docs/components/tabs/demo.ts
  • apps/www/src/content/docs/components/tabs/index.mdx
  • apps/www/src/content/docs/components/tabs/props.ts
  • packages/raystack/components/tabs/__tests__/tabs.test.tsx
  • packages/raystack/components/tabs/tabs.module.css
  • packages/raystack/components/tabs/tabs.tsx

Comment on lines +12 to 26
.size-small {
--tabs-trigger-height: var(--rs-space-6);
--tabs-trigger-padding-inline: var(--rs-space-2);
--tabs-trigger-font-size: var(--rs-font-size-mini);
--tabs-trigger-line-height: var(--rs-line-height-mini);
--tabs-trigger-letter-spacing: var(--rs-letter-spacing-mini);
}

.size-medium {
--tabs-trigger-height: var(--rs-space-7);
--tabs-trigger-padding-inline: var(--rs-space-3);
--tabs-trigger-font-size: var(--rs-font-size-small);
--tabs-trigger-line-height: var(--rs-line-height-small);
--tabs-trigger-letter-spacing: var(--rs-letter-spacing-small);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing default modifier classes creates a class contract gap.

TabsRoot now maps size="large" and variant="segmented" to CSS-module keys, but this stylesheet does not define .size-large or .variant-segmented. That breaks the expected root modifier contract for defaults.

💡 Suggested fix
 .size-medium {
   --tabs-trigger-height: var(--rs-space-7);
   --tabs-trigger-padding-inline: var(--rs-space-3);
   --tabs-trigger-font-size: var(--rs-font-size-small);
   --tabs-trigger-line-height: var(--rs-line-height-small);
   --tabs-trigger-letter-spacing: var(--rs-letter-spacing-small);
 }
+
+.size-large {
+  --tabs-trigger-height: var(--rs-space-8);
+  --tabs-trigger-padding-inline: var(--rs-space-3);
+  --tabs-trigger-font-size: var(--rs-font-size-regular);
+  --tabs-trigger-line-height: var(--rs-line-height-regular);
+  --tabs-trigger-letter-spacing: var(--rs-letter-spacing-regular);
+}
@@
 .variant-standalone .list,
 .variant-plain .list {
   background-color: transparent;
   box-shadow: none;
 }
+
+.variant-segmented .list {
+  background-color: var(--rs-color-background-neutral-secondary);
+  box-shadow: var(--rs-shadow-inset);
+}

Also applies to: 126-169

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/raystack/components/tabs/tabs.module.css` around lines 12 - 26,
TabsRoot maps size="large" and variant="segmented" (and other defaults) to
CSS-module keys that don't exist in tabs.module.css, creating a contract gap;
add the missing modifier classes (.size-large, .variant-segmented and any other
referenced but undefined modifier classes) to tabs.module.css and define the
same CSS custom properties/values as the existing size/variant classes (or
appropriate defaults) so the class names used by TabsRoot match actual
stylesheet keys.

@paanSinghCoder paanSinghCoder changed the title feat: add tabs variants ans sizes feat: add tabs variants and sizes Mar 31, 2026
@paanSinghCoder paanSinghCoder changed the title feat: add tabs variants and sizes feat (tabs): add variants and sizes Mar 31, 2026
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