fix(docs): prevent component preview clipping - #1935
Conversation
📝 WalkthroughWalkthroughThe preview container now uses ChangesPreview layout
Estimated code review effort: 1 (Trivial) | ~2 minutes Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/v4/components/ComponentPreviewTabs.vue`:
- Line 38: Update the preview class list in ComponentPreviewTabs to add
data-[chromeless=true]:min-h-0 alongside the existing chromeless height and
padding overrides, ensuring chromeless previews no longer retain the min-h-72
constraint.
🪄 Autofix
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: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8ba2df41-ac23-4fb1-9497-361be97b1184
📒 Files selected for processing (1)
apps/v4/components/ComponentPreviewTabs.vue
| :data-chromeless="chromeLessOnMobile" | ||
| :class="cn( | ||
| 'preview relative flex h-72 w-full justify-center p-10 data-[align=center]:items-center data-[align=end]:items-start data-[align=start]:items-start data-[chromeless=true]:h-auto data-[chromeless=true]:p-0 sm:data-[align=end]:items-end', | ||
| 'preview relative flex min-h-72 w-full justify-center p-10 data-[align=center]:items-center data-[align=end]:items-start data-[align=start]:items-start data-[chromeless=true]:h-auto data-[chromeless=true]:p-0 sm:data-[align=end]:items-end', |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -eu
file="apps/v4/components/ComponentPreviewTabs.vue"
printf '%s\n' '--- target file ---'
cat -n "$file" | sed -n '1,110p'
printf '%s\n' '--- related chromeless usage ---'
rg -n -C 3 'chromeless|ComponentPreviewTabs' apps/v4 --glob '*.vue' --glob '*.ts' --glob '*.tsx' | head -240
printf '%s\n' '--- Tailwind/config context ---'
rg -n -C 3 'min-h-72|data-\[chromeless=true\]:h-auto|tailwind|`@theme`' apps/v4 --glob '*.{vue,ts,js,css}' | head -240Repository: unovue/shadcn-vue
Length of output: 23836
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- chromeless prop definitions and call sites ---'
rg -n -C 5 'chromeLessOnMobile|chrome-less-on-mobile|chromeless' apps/v4 --glob '*.{vue,ts,tsx,js}' | head -320
printf '%s\n' '--- ComponentPreview prop forwarding ---'
cat -n apps/v4/components/content/ComponentPreview.vue | sed -n '1,90p'
printf '%s\n' '--- relevant change summary ---'
git diff --stat -- apps/v4/components/ComponentPreviewTabs.vue
git diff -- apps/v4/components/ComponentPreviewTabs.vue | sed -n '1,140p'
printf '%s\n' '--- available CSS tooling ---'
command -v node || true
command -v npm || true
test -d node_modules && echo root-node_modules-present || true
test -d apps/v4/node_modules && echo apps-v4-node_modules-present || trueRepository: unovue/shadcn-vue
Length of output: 5595
🏁 Script executed:
#!/bin/bash
set -eu
python3 - <<'PY'
# Read-only CSS cascade model for the two declarations in the reviewed class list.
# Both declarations apply to a chromeless element; the result depends on cascade
# order, not on h-auto removing min-height.
rules = [
("min-h-72", "min-height", "18rem", 0),
("data-[chromeless=true]:min-h-0", "min-height", "0px", 1),
]
chromeless = True
applicable = [
rule for rule in rules
if rule[0] == "min-h-72" or (chromeless and rule[0].startswith("data-[chromeless=true]:"))
]
winner = max(applicable, key=lambda rule: (rule[3],))
print("chromeless=true applicable min-height declarations:")
for rule in applicable:
print(f" {rule[0]} -> {rule[2]}")
print(f"modelled override: {winner[0]} -> {winner[2]}")
print("h-auto changes height, not min-height")
PYRepository: unovue/shadcn-vue
Length of output: 362
🏁 Script executed:
#!/bin/bash
set -eu
node - <<'JS'
const fs = require('node:fs')
const path = require('node:path')
for (const base of ['node_modules/tailwindcss', 'apps/v4/node_modules/tailwindcss']) {
const pkg = path.join(base, 'package.json')
if (fs.existsSync(pkg)) {
console.log(`${pkg}: ${JSON.parse(fs.readFileSync(pkg, 'utf8')).version}`)
}
}
JS
node - <<'JS'
const fs = require('node:fs')
const path = require('node:path')
function load(name) {
for (const base of ['node_modules', 'apps/v4/node_modules']) {
try {
return require(require.resolve(name, { paths: [path.resolve(base)] }))
} catch {}
}
throw new Error(`Cannot resolve ${name}`)
}
const tailwind = load('tailwindcss')
const candidates = [
'min-h-72',
'h-auto',
'data-[chromeless=true]:h-auto',
'data-[chromeless=true]:min-h-0',
]
const source = `
`@theme` { --spacing: 0.25rem; }
`@tailwind` utilities;
`
const compile = tailwind.compile(source)
const css = compile.build(candidates)
console.log(css)
JSRepository: unovue/shadcn-vue
Length of output: 743
🏁 Script executed:
#!/bin/bash
set -eu
printf '%s\n' '--- declared Tailwind dependencies ---'
rg -n -C 2 '"(`@tailwindcss/vite`|tailwindcss|tailwind-merge)"' package.json apps/v4/package.json pnpm-lock.yaml yarn.lock package-lock.json 2>/dev/null | head -160 || true
printf '%s\n' '--- arbitrary data variants using min-height utilities ---'
rg -n 'data-\[[^]]+\]:min-h-|data-\[[^]]+\]:h-|min-h-72|data-\[[^]]+\]:p-0' apps/v4 --glob '*.{vue,ts,tsx,css,html}' | head -240
printf '%s\n' '--- installed Tailwind-related package directories ---'
find node_modules apps/v4/node_modules -maxdepth 2 -type d \( -iname '*tailwind*' -o -iname '*oxide*' \) -print 2>/dev/null | head -120Repository: unovue/shadcn-vue
Length of output: 50373
Reset the minimum height in chromeless mode.
When data-chromeless="true", h-auto does not remove min-h-72. Short chromeless previews can retain an unnecessary 18rem minimum height. Add data-[chromeless=true]:min-h-0.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@apps/v4/components/ComponentPreviewTabs.vue` at line 38, Update the preview
class list in ComponentPreviewTabs to add data-[chromeless=true]:min-h-0
alongside the existing chromeless height and padding overrides, ensuring
chromeless previews no longer retain the min-h-72 constraint.
|
@zernonia I noticed that commit 03554c9 changed the component preview container from min-h-72 to the fixed height h-72. Could you share the reason for this adjustment? |
|
Thanks for the fix @jevin98 , I've gone through and fix those previewClass, should be all good now |
Fixes component demos whose content is taller than the default preview area being clipped before it reaches the code panel. Commit
03554c98changed the shared preview wrapper inComponentPreviewTabs.vuefrommin-h-72to the fixed heighth-72; because the outer preview card usesoverflow-hidden, taller demos such as Table lost their final rows, footer, and caption.This restores
min-h-72, preserving the 18rem default while allowing the preview wrapper to grow with its rendered component. The alignment changes from the original commit remain unchanged.Summary by CodeRabbit