---
title: "Eject a part, page or email"
description: "Copy a packaged part, page or email into your app to own its source, with the version stamp that lets upgrade show what changed upstream."
canonical_url: "https://nuxt-backend.dev/docs/build/ui/customize/eject"
---
# Eject a part, page or email

> Copy a packaged part, page or email into your app to own its source, with the version stamp that lets upgrade show what changed upstream.

Version: nuxt-backend 0.6.x · Tab: Build · Kind: how-to · Status: stable

Every page: [llms.txt](https://nuxt-backend.dev/llms.txt) · Skill for coding agents: [nuxt-backend](https://nuxt-backend.dev/.well-known/skills/nuxt-backend/SKILL.md)

Commands use npm; use your project's package manager.

- [Source](https://github.com/qruto/nuxt-backend/blob/main/src/cli/eject.ts)

Take the packaged plan card's source into your app, change anything in it, and still learn what the package changed when you upgrade. This is the copy-in pattern that shadcn-vue's registry made common: the source becomes yours. `npx nuxt-backend eject` copies a part, a page or an email, its `.vue` file and its CSS, and stamps it with the package version; `npx nuxt-backend upgrade` later diffs your copy against the new version.

## Eject a part

```bash
npx nuxt-backend eject PricingPlanCard
```

```text
✔ app/components/PricingPlanCard.vue      from nuxt-backend 0.2.0
✔ app/components/PricingPlanCard.css      from nuxt-backend 0.2.0
```

The CSS keeps the part's rules inside `@layer nuxt-backend`, and the `.vue` file loads it with `<style src>`. The copy has the part's name, so it [swaps the part](https://nuxt-backend.dev/docs/build/ui/customize/parts) everywhere at once, packaged pages included. Its first line is the stamp:

```vue [app/components/PricingPlanCard.vue]
<!-- nuxt-backend eject: PricingPlanCard@0.2.0 -->
<script setup lang="ts">
import type { PricingPlanCardProps } from '#backend/parts'

const props = defineProps<PricingPlanCardProps>()
const { t } = useLabels('pricing')
</script>
```

The copy keeps using the composables, labels and bindings, so the state and the accessibility attributes still come from the package: its imports point at `#backend/parts`, `#backend/a11y` and `#backend/runtime`, the package's own code, instead of relative paths. Only the markup and the CSS are now yours.

## Eject a page or an email

<table>
<thead>
  <tr>
    <th>
      You eject
    </th>
    
    <th>
      Command
    </th>
    
    <th>
      Written to
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      A part
    </td>
    
    <td>
      <code>
        npx nuxt-backend eject PricingPlanCard
      </code>
    </td>
    
    <td>
      <code>
        app/components/PricingPlanCard.vue
      </code>
      
       and its CSS
    </td>
  </tr>
  
  <tr>
    <td>
      A page
    </td>
    
    <td>
      <code>
        npx nuxt-backend eject page:pricing
      </code>
    </td>
    
    <td>
      <code>
        app/pages/pricing.vue
      </code>
      
      , with its guard in <code>
        definePageMeta
      </code>
      
      , at the path <code>
        pages.pricing
      </code>
      
       gives it
    </td>
  </tr>
  
  <tr>
    <td>
      A component
    </td>
    
    <td>
      <code>
        npx nuxt-backend eject AuthForm
      </code>
    </td>
    
    <td>
      <code>
        app/components/AuthForm.vue
      </code>
      
       and its CSS; its parts stay packaged
    </td>
  </tr>
  
  <tr>
    <td>
      An email
    </td>
    
    <td>
      <code>
        npx nuxt-backend eject email:otp
      </code>
    </td>
    
    <td>
      <code>
        backend/emails/otp.ts
      </code>
      
      , added to <code>
        templates
      </code>
      
       in <code>
        backend/email.ts
      </code>
    </td>
  </tr>
</tbody>
</table>

`npx nuxt-backend eject --list` prints every part, component, page key and email you can eject, with the ones already ejected marked. The emails are `email:otp`, `email:passkeyRecovered`, `email:emailChanged`, `email:deletionScheduled`, `email:deletionCanceled`, `email:welcome`, `email:invite`, `email:gift`, `email:waitlistConfirmation` and `email:waitlistAdmitted`, each written to a kebab-case file (`email:emailChanged` to `backend/emails/email-changed.ts`). When `setupEmail` in `backend/email.ts` has a shape `eject` cannot edit, it writes the template and prints the line to add.

An ejected page replaces the packaged one at its path, as any page of yours would. It composes the packaged parts, so each part inside it still upgrades unless you eject that part too. An ejected email is the template's own source: the blocks it builds, every word read from its labels through `t`, and its plain-text part, with the helpers it uses (`linkBlocks`, `describeOrigin`, `plainName`) imported from `nuxt-backend/email` ([Customize email templates](https://nuxt-backend.dev/docs/build/email/templates#eject-an-email)).

## Show it in a page

Nothing to wire: a part's copy swaps the part, a page's copy serves its path, an email's copy is sent in place of the packaged one, since `eject` adds it to `templates`. Open `/pricing` to see your copy of the plan card.

## Upgrade an ejected file

```bash
npx nuxt-backend upgrade
```

```text
Ejected files
  PricingPlanCard      0.2.0 → 0.3.0      2 upstream changes
                       npx nuxt-backend upgrade --diff PricingPlanCard
```

`upgrade` reads each stamp, compares the packaged source at that version with the installed one, and counts the changed hunks; `upgrade --diff PricingPlanCard` prints them as a unified diff for you to apply by hand, and writes nothing. It never rewrites an ejected file. Once you have carried the changes over, set the version in the stamp to the installed one, and `upgrade` stops listing the file. The older source comes from the published package on the jsDelivr CDN, so this step needs the network.

## What happens when…

<table>
<thead>
  <tr>
    <th>
      Situation
    </th>
    
    <th>
      Result
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      The name is not a part, page key or email
    </td>
    
    <td>
      <code>
        eject
      </code>
      
       lists the close matches and writes nothing
    </td>
  </tr>
  
  <tr>
    <td>
      The target file exists
    </td>
    
    <td>
      <code>
        eject
      </code>
      
       stops; pass <code>
        --force
      </code>
      
       to overwrite
    </td>
  </tr>
  
  <tr>
    <td>
      A part was removed upstream
    </td>
    
    <td>
      <code>
        upgrade
      </code>
      
       says it is no longer shipped; the <a href="https://nuxt-backend.dev/docs/ship/releases/upgrade">
        Upgrade page
      </a>
      
       names what replaces it
    </td>
  </tr>
  
  <tr>
    <td>
      The older source cannot be fetched
    </td>
    
    <td>
      <code>
        upgrade
      </code>
      
       says so beside the file, and the rest of the run goes on
    </td>
  </tr>
  
  <tr>
    <td>
      You delete the copy
    </td>
    
    <td>
      The packaged part, page or email comes back on the next build
    </td>
  </tr>
</tbody>
</table>

## Limits

- **Eject is the last rung.** Every upstream fix to an ejected file now needs your hand. Try a [token](https://nuxt-backend.dev/docs/build/ui/customize/tokens), a [slot](https://nuxt-backend.dev/docs/build/ui/customize/slots) or a [swapped part](https://nuxt-backend.dev/docs/build/ui/customize/parts) first.
- **Markup and CSS only.** Composables, server functions and the component contract are never ejected.
- **Accessibility is yours.** Keep the bindings in the copy, and what the region promised ([Accessibility](https://nuxt-backend.dev/docs/build/ui/accessibility#what-a-replacement-must-keep)).

## Test it

Run your component tests and the axe check in your end-to-end suite after each eject and each upgrade ([Test pages over a mock backend](https://nuxt-backend.dev/docs/develop/testing/pages)).

## Related

- [Customization ladder](https://nuxt-backend.dev/docs/build/ui/customize): the rungs below eject.
- [Swap a part](https://nuxt-backend.dev/docs/build/ui/customize/parts): the same name, without a copy of the source.
- [Parts](https://nuxt-backend.dev/docs/reference/components/parts): every part you can eject.
- [CLI](https://nuxt-backend.dev/docs/reference/cli): `eject` and `upgrade`.
- [Upgrade to a new version](https://nuxt-backend.dev/docs/ship/releases/upgrade): what `upgrade` does beyond ejected files.


## Sitemap

See the full [sitemap](https://nuxt-backend.dev/sitemap.md) for all pages.
