Skip to content

ProseImg w-full overrides markdown width attribute #6349

@nimonian

Description

@nimonian

Environment

Nuxt project info:

Operating system Linux 6.17.0-20-generic
CPU 13th Gen Intel(R) Core(TM) i7-1355U (12 cores)
Node.js version v25.6.0
nuxt/cli version 3.34.0
Package manager npm@11.8.0
Nuxt version 4.4.2
Nitro version 2.13.3
Builder vite@7.3.2
Config compatibilityDate, css, devtools, modules
Modules @nuxt/ui@4.6.1, @nuxt/content@3.13.0, @nuxt/image@2.0.0

Is this bug related to Nuxt or Vue?

Nuxt

Package

v4.x

Version

4.6.1

Reproduction

https://github.com/nimonian/nuxt-ui-img-repro

Description

![an image](source.jpg){width=200} should always render an image 200px wide

however, Nuxt UI's ProseImg component always applies w-full in its base slot theme, which clobbers widths chosen from markdown

// .nuxt/ui/prose/img.ts
slots: {
    base: "rounded-md w-full" 
  }

consequently, images always stretch to 100% of parent width

note that this bug will only occur when we have

 /* app/assets/css/main.css */
  @import "tailwindcss";
  @import "@nuxt/ui";

without this, tailwind appears not to compile the w-full utility which masks the issue

i believe the example in the Nuxt UI docs only appears to function correctly because it is wrapped in a flex container

the whole pipeline works correctly - width="200" does appear on the element - but the width: 100% coming from tailwind will always win


i intend to submit a PR for this

Additional context

Image

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageAwaiting initial review and prioritizationv4#4488

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions