Getting Started

Laravel

Install Nuxt Motion Block in a Laravel + Inertia app - the same setup as Nuxt UI in Laravel.

Installation

Nuxt Motion Block works in any Laravel app using Inertia.js + Vue, exactly the same way Nuxt UI does. The steps are identical to the plain Vue setup, with laravel-vite-plugin alongside it.

pnpm add nuxt-motion-block @nuxt/ui motion-v

Setup

Add the Laravel and Nuxt UI plugins in vite.config.ts:

vite.config.ts
import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'
import vue from '@vitejs/plugin-vue'
import ui from '@nuxt/ui/vite'

export default defineConfig({
  plugins: [
    laravel({
      input: ['resources/js/app.ts'],
      refresh: true,
    }),
    vue({
      template: {
        transformAssetUrls: {
          base: null,
          includeAbsolute: false,
        },
      },
    }),
    ui(),
  ],
})

Use the plugins in resources/js/app.ts:

resources/js/app.ts
import { createInertiaApp } from '@inertiajs/vue3'
import { resolvePageComponent } from 'laravel-vite-plugin/inertia-helpers'
import ui from '@nuxt/ui/vue-plugin'
import motionBlock from 'nuxt-motion-block/vue-plugin'
import { createApp, h } from 'vue'
import { ZiggyVue } from '../../vendor/tightenco/ziggy'

createInertiaApp({
  title: title => (title ? `${title} - ${appName}` : appName),
  resolve: name =>
    resolvePageComponent(
      `./Pages/${name}.vue`,
      import.meta.glob<DefineComponent>('./Pages/**/*.vue')
    ),
  setup({ el, App, props, plugin }) {
    createApp({ render: () => h(App, props) })
      .use(plugin)
      .use(ZiggyVue)
      .use(ui)
      .use(motionBlock)
      .mount(el)
  },
})

Import Tailwind CSS with Nuxt UI and Nuxt Motion Block in resources/css/app.css:

resources/css/app.css
@import "tailwindcss";
@import "@nuxt/ui";
@import "nuxt-motion-block/runtime/tailwind.css";

Make sure the #app root is isolate (scopes Nuxt UI & Nuxt Motion Block overlays):

resources/views/app.blade.php
<body>
  <div id="app" class="isolate"></div>
  @inertia
</body>

Usage

Every public component is globally registered with the M prefix. Use them in any Inertia page just like in Nuxt:

resources/js/Pages/Welcome.vue
<template>
  <MTextShimmer placeholder="Works in Laravel!" />
</template>

To override a component's theming (ui.<name> slot overrides), pass it to the plugin:

resources/js/app.ts
import ui from '@nuxt/ui/vue-plugin'
import motionBlock from 'nuxt-motion-block/vue-plugin'

// in setup(), after .use(ui):
.use(motionBlock, {
  ui: {
    textShimmer: { root: 'font-mono' },
  },
})

AdonisJS

Exactly the same shape with @adonisjs/vite/client and @adonisjs/inertia/client instead of laravel-vite-plugin. See Nuxt UI's docs — everything except the Laravel-specific plugin is identical.

Peer dependencies

PackageVersion
vue^3.5.0
@nuxt/ui>=4.11.2
motion-v>=2.4.4

Nuxt is not required.