Drawer.stx:33 builds its width utility by interpolation:
// `size` widens a side drawer without the app having to know that the width
// lives on the wrapper rather than the panel. Ignored for top/bottom, which
// are constrained by height instead.
const width = $props.size ? `max-w-${$props.size}` : 'max-w-md'max-w-${size} never exists as a literal string anywhere in the source tree, so a content-scanning CSS engine never sees it and never emits the rule. <Drawer size="xl"> renders class="… max-w-xl w-screen" against a stylesheet that has no .max-w-xl in it, and the drawer falls back to w-screen - full width, which is the one thing size was there to prevent.
The default is unaffected, because 'max-w-md' is a literal in that same expression. So the prop works until you pass it.
Verified against crosswind, not assumed
<div class="max-w-3xl">literal</div>
<script server>
const size = 'xl'
const width = `max-w-${size}`
</script>
<div class="">interpolated</div>$ crosswind build --content "__cwprobe.stx" --output out.css
✅ Built 3 classes in 13.86ms
$ grep -oE "\.max-w-[a-zA-Z0-9-]+" out.css | sort -u
.max-w-3xl.max-w-xl is absent. Only the literal survives. (crosswind 0.2.16, the engine our apps build with.)
This is the standard JIT-scanner constraint rather than anything crosswind-specific - Tailwind documents the same rule - so the component cannot rely on an interpolated class name under any of the engines an app might use.
Fix
Same shape as the positionClasses map directly above it, so the strings are literal and scannable:
const widthClasses = {
sm: 'max-w-sm', md: 'max-w-md', lg: 'max-w-lg',
xl: 'max-w-xl', '2xl': 'max-w-2xl', '3xl': 'max-w-3xl',
full: 'max-w-full',
}
const width = widthClasses[$props.size] || widthClasses.mdThat also brings size under whatever you decide for #2001, since it is the same silent-miss shape.
If you would rather keep size open-ended, the alternative is to stop expressing it as a utility at all and put it on panelStyle as a max-width - the escape hatch the file's own comment block already reaches for when it explains why panelStyle exists.
Happy to send the PR.
Environment: main @ a198835, @stacksjs/components 0.2.343, crosswind 0.2.16.