Nuxt 3
Oruga doesn't provide an official Nuxt module, but you can install it in a Nuxt 3 application using Nuxt's plugin system. Nuxt automatically discovers plugins in the plugins/ directory, so no manual registration is needed in nuxt.config.ts.
For instructions on creating a Nuxt app, see the Nuxt 3 installation guide. For details about plugin discovery, see the Nuxt 3 plugin documentation.
Install Oruga
npm install @oruga-ui/oruga-nextRegister Oruga
Create plugins/oruga.ts:
import { createOruga } from "@oruga-ui/oruga-next";
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(createOruga());
});This plugin is loaded automatically. Use a regular oruga.ts plugin so Oruga is installed for both server-side rendering and the client.
See the configuration and component documentation for configuration options.
Use components
Components are not registered globally by default. Import the components you need in your Vue single-file components:
<script setup lang="ts">
import { OButton } from "@oruga-ui/oruga-next";
</script>
<template>
<OButton>Oruga is ready</OButton>
</template>If you prefer global components, import their component plugins and register them on the Oruga instance:
import { Button, createOruga } from "@oruga-ui/oruga-next";
export default defineNuxtPlugin((nuxtApp) => {
const oruga = createOruga();
oruga.use(Button);
nuxtApp.vueApp.use(oruga);
});Register only the components you need to keep your bundle tree-shakeable. See the Introduction for more about component registration.
Add a theme
Oruga has no styles by default. To use the Oruga theme, install it:
npm install @oruga-ui/theme-orugaAdd the stylesheet to nuxt.config.ts:
export default defineNuxtConfig({
css: ["@oruga-ui/theme-oruga/style.css"],
});The Oruga theme uses Oruga's default class configuration, so adding its stylesheet is enough; keep the plugins/oruga.ts plugin from above.
You can also use your own styles instead or one of the other available themes.
Use framework based themes
Framework based themes like Bulma or Bootstrap provide both styles and a theme-specific Oruga configuration. Install the theme you want to use, for example Bulma:
npm install @oruga-ui/theme-bulmaReplace the Oruga stylesheet in nuxt.config.ts with the stylesheet for the framework theme you installed. These stylesheets include the corresponding framework styles as well as Oruga's theme styles:
export default defineNuxtConfig({
css: ["@oruga-ui/theme-bulma/style.css"],
});Then pass the theme's configuration to createOruga:
import { createOruga } from "@oruga-ui/oruga-next";
import { bulmaConfig } from "@oruga-ui/theme-bulma";
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.vueApp.use(createOruga(bulmaConfig));
});See the themes documentation for configuration details on the other themes.
Use only one Oruga plugin: the framework theme config maps Oruga components to the framework's classes, while the stylesheet provides their visual styles. Unlike the default Oruga theme, these themes need the extra plugin configuration as well as CSS.
Custom Icons
Oruga's default icon pack is Material Design Icons. If you use it, install the font package and add its stylesheet alongside your theme stylesheet:
npm install @mdi/fontexport default defineNuxtConfig({
css: [
"@oruga-ui/theme-bulma/style.css",
"@mdi/font/css/materialdesignicons.min.css",
],
});