Skip to content

style(theme/Tabs): add default padding to tab panels and support nested tabs#3217

Merged
SoonIter merged 2 commits intomainfrom
syt-vibe-kanban/ccf2-tab-codeblock
Mar 16, 2026
Merged

style(theme/Tabs): add default padding to tab panels and support nested tabs#3217
SoonIter merged 2 commits intomainfrom
syt-vibe-kanban/ccf2-tab-codeblock

Conversation

@SoonIter
Copy link
Copy Markdown
Member

@SoonIter SoonIter commented Mar 12, 2026

Summary

source:

```mdx
<Tab label="docs/_mdx-fragment.mdx">

Check:

```mdx file="./_mdx-fragment.mdx"

```

Install:

```mdx file="./_mdx-fragment.mdx"

```


</Tab>
```

before

image

after

image

Related Issue

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

AI Summary

What changed

  • Added default padding (0 1rem) and vertical margin (1rem) to .rp-tabs__content__item so that non-codeblock tab content has proper spacing.
  • Used CSS :has(> .rp-codeblock:only-child) to detect when a tab panel contains only a single CodeBlock, and removes the panel padding in that case to avoid double padding.
  • Added box-shadow: none to .rp-tabs .rp-codeblock to fully reset CodeBlock's standalone visual styles when nested inside Tabs (previously margin, border-radius, and border were reset but box-shadow was missed).

Why

When Tab panels had no default padding, non-codeblock content was flush against the edges. But simply adding padding caused double spacing when the tab content was a single CodeBlock (since CodeBlock has its own internal padding). The :has() CSS pseudo-class cleanly solves this without any React runtime changes.

This PR was written using Vibe Kanban


Copilot AI review requested due to automatic review settings March 12, 2026 07:02
@SoonIter SoonIter marked this pull request as draft March 12, 2026 07:02
@SoonIter SoonIter changed the title 有什么方法判断 Tab 组件中,有且仅含有一个 Codeblock 的组件 (vibe-kanban) fix(theme): add default padding to tab panels and avoid double padding with codeblock Mar 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 12, 2026

Rsdoctor Bundle Diff Analysis

Found 3 projects in monorepo, 1 project with changes.

📊 Quick Summary
Project Total Size Change
node 12.4 MB 0
web 16.1 MB +99.0 B (0.0%)
node_md 1.6 MB 0
📋 Detailed Reports (Click to expand)

📁 web

Path: website/doc_build/diff-rsdoctor/web/rsdoctor-data.json

📌 Baseline Commit: 0ea1fdd4ed | PR: #3232

Metric Current Baseline Change
📊 Total Size 16.1 MB 16.1 MB +99.0 B (0.0%)
📄 JavaScript 15.9 MB 15.9 MB 0
🎨 CSS 120.4 KB 120.3 KB +99.0 B (0.1%)
🌐 HTML 0 B 0 B 0
📁 Other Assets 166.2 KB 166.2 KB 0

📦 Download Diff Report: web Bundle Diff

Generated by Rsdoctor GitHub Action

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 12, 2026

Deploying rspress-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9133539
Status: ✅  Deploy successful!
Preview URL: https://950c0afb.rspress-v2.pages.dev
Branch Preview URL: https://syt-vibe-kanban-ccf2-tab-cod.rspress-v2.pages.dev

View logs

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts the theme styling for the Tabs component to improve spacing inside tab panels, especially for content that expects consistent gaps (per issue #3194), while special-casing the “single CodeBlock only” scenario to avoid double padding.

Changes:

  • Remove box-shadow from CodeBlock when rendered inside Tabs.
  • Add horizontal padding to each tab panel and enforce top/bottom spacing for the panel’s first/last child.
  • Use :has(> .rp-codeblock:only-child) to remove the panel padding when the panel contains exactly one CodeBlock.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@SoonIter SoonIter force-pushed the syt-vibe-kanban/ccf2-tab-codeblock branch from 0310a14 to ce0053d Compare March 16, 2026 12:02
@SoonIter SoonIter changed the title fix(theme): add default padding to tab panels and avoid double padding with codeblock style(theme/Tabs): add default padding to tab panels and avoid double padding with codeblock Mar 16, 2026
@SoonIter SoonIter changed the title style(theme/Tabs): add default padding to tab panels and avoid double padding with codeblock style(theme/Tabs): add default padding to tab panels and support nested tabs Mar 16, 2026
@SoonIter SoonIter marked this pull request as ready for review March 16, 2026 12:10
@SoonIter SoonIter requested a review from Timeless0911 March 16, 2026 12:10
@SoonIter SoonIter enabled auto-merge (squash) March 16, 2026 12:10
@SoonIter SoonIter merged commit 57912a0 into main Mar 16, 2026
6 checks passed
@SoonIter SoonIter deleted the syt-vibe-kanban/ccf2-tab-codeblock branch March 16, 2026 12:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: New Tab/Tabs component doesn't look great for content expecting gaps

3 participants