Describe the bug
When using Histoire with Nuxt 4 and Nuxt UI, rendering a component that internally uses UButton causes a runtime error and prevents the story from rendering.
The error occurs immediately when opening the story. Components that directly use NuxtLink do not trigger this issue, which suggests the problem may be related to how UButton integrates NuxtLink internally when running inside Histoire.
Reproduction
I used the Nuxt 4 example from the official repository, where I simply added Nuxt UI to the project and modified the BaseButton component to use the UButton component from Nuxt UI.
Stackblitz example to play on live error here
Steps to reproduce
- Create a standard Nuxt 4/Tailwind 4 project
- Install and configure Histoire using
@histoire/plugin-nuxt
- Install
@nuxt/ui
- Create a component that uses
UButton internally (e.g. BaseButton)
- Create a Histoire story for that component
- Open the story in the Histoire UI
Minimal reproduction (story example)
<Story
title="BaseButton"
:layout="{
type: 'grid',
width: 200,
}"
>
<Variant
title="playground"
:init-state="initState"
>
<template #default="{ state }">
<BaseButton
:disabled="state.disabled"
>
Click me
</BaseButton>
</template>
</Variant>
</Story>
BaseButton internally uses UButton from @nuxt/ui.
Actual behavior
- The component is not rendered
- The following error appears in the browser console:
Uncaught (in promise) TypeError: Cannot destructure property 'href' of 'undefined' as it is undefined.
at Proxy.<anonymous> (virtual:nuxt:C:/User…/components.mjs:12:28)
Expected behavior
UButton should render correctly inside Histoire without throwing runtime errors.
Additional notes
- Using
NuxtLink directly inside a story works without issues
- The error only appears when using
UButton
- This may be related to how Histoire mocks or provides Nuxt internals (router / link handling)
System Info
### Environment
* **Nuxt**: `4.2.2`
* **Vue**: `3.5.26`
* **Histoire**: `1.0.0-beta.1`
* **@histoire/plugin-nuxt**: `1.0.0-beta.1`
* **@nuxt/ui**: `4.3.0`
* **Node.js**: (same as local environment)
* **Package manager**: pnpm
#### `package.json`
{
"name": "histoire-example-nuxt4",
"type": "module",
"version": "0.0.1",
"private": true,
"scripts": {
"story:dev": "histoire dev",
"story:build": "histoire build",
"story:preview": "histoire preview --port 4567",
"ci": "start-server-and-test story:preview http://localhost:4567/ test",
"test": "cypress run",
"test:dev": "cypress open --config baseUrl=http://localhost:6006",
"test:examples": "pnpm run story:build && pnpm run ci"
},
"devDependencies": {
"@histoire/plugin-nuxt": "^1.0.0-beta.1",
"@histoire/plugin-vue": "^1.0.0-beta.1",
"@nuxtjs/tailwindcss": "^6.12.2",
"cypress": "^13.16.1",
"histoire": "^1.0.0-beta.1",
"nuxt": "^4.2.2",
"start-server-and-test": "^2.0.8",
"vue": "^3.5.26"
},
"dependencies": {
"@nuxt/ui": "^4.3.0"
}
}
Used Package Manager
npm
Validations
Describe the bug
When using Histoire with Nuxt 4 and Nuxt UI, rendering a component that internally uses UButton causes a runtime error and prevents the story from rendering.
The error occurs immediately when opening the story. Components that directly use NuxtLink do not trigger this issue, which suggests the problem may be related to how UButton integrates NuxtLink internally when running inside Histoire.
Reproduction
I used the Nuxt 4 example from the official repository, where I simply added Nuxt UI to the project and modified the
BaseButtoncomponent to use theUButtoncomponent from Nuxt UI.Stackblitz example to play on live error here
Steps to reproduce
@histoire/plugin-nuxt@nuxt/uiUButtoninternally (e.g.BaseButton)Minimal reproduction (story example)
Actual behavior
Uncaught (in promise) TypeError: Cannot destructure property 'href' of 'undefined' as it is undefined. at Proxy.<anonymous> (virtual:nuxt:C:/User…/components.mjs:12:28)Expected behavior
UButtonshould render correctly inside Histoire without throwing runtime errors.Additional notes
NuxtLinkdirectly inside a story works without issuesUButtonSystem Info
Used Package Manager
npm
Validations