Setting up a theme

Create a theme from your Nuxt app in a few simple steps.


A theme share a similar structure as any other Nuxt project.

Turning a Nuxt project into a theme is as easy as adding a module and configuring it.

Let's walk through the steps of this process:

Add the module

Yarn
yarn add --dev @nuxt-themes/config
NPM
npm install @nuxt-themes/config --save-dev
nuxt.config.ts
export default defineNuxtConfig({  modules: [    '@nuxt-themes/config/module'  ]})
As @nuxt-themes/config provides integrations with other Nuxt modules, you might want to add it as the first module of the list.

Define theme metas

nuxt.config.ts
export default defineNuxtConfig({  theme: {    meta: {      name: 'My Awesome Theme',      description: 'A really cool theme for your Nuxt app.',      author: '@Tahul',      url: 'https://myawesometheme.com',    }  },  modules: [    '@nuxt-themes/config/module'  ]})
Bravo! Your Nuxt app is now a theme.

Prepare for release

Releasing a Nuxt Theme is as easy as publishing your Nuxt app on NPM!

Let's prepare your project for this.

package.json
{  "name": "my-nuxt-theme",  "version": "1.0.0",  "description": "Toolkit for authoring Nuxt Themes",  "main": "./nuxt.config.ts",  "exports": {    ".": "./nuxt.config.ts",    "./*": "./*/*.*"  },}
npm publish --access public+ my-nuxt-theme@1.0.0Your theme is published āœØ

Use your theme

NPM
npm install my-nuxt-theme --save-dev
Yarn
yarn add --dev my-nuxt-theme
nuxt.config.ts
export default defineNuxtConfig({  extends: ['my-nuxt-theme'],  app: {    theme: {      // Your theme options      options: {},      // Your theme design tokens      tokens: {}    }  }})
yarn dev Nuxt CLI v3.0.0-rc.4> Local:    http://localhost:3000 ā„¹ @nuxt-themes/config v1.0.0 enabled!ā„¹ Using My Awesome Theme by @Tahulāœ” Tokens built succesfully!  You are now using your theme šŸŽ‰