#Setup Nuxt Content with Nuxt pages and layouts
23 messages · Page 1 of 1 (latest)
Hi @proven zenith. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
To set up a Nuxt 4 project for a documentation website with Nuxt Content, Nuxt UI, and Nuxt Icons, and to enable content editing with user permissions, you can follow these steps based on the official documentation and templates:
1. Install Nuxt Content, UI, and Icons
Install the required modules:
npm install @nuxt/content @nuxt/ui @nuxt/icons
Then, register them in your nuxt.config.ts:
export default defineNuxtConfig({
modules: [
'@nuxt/ui',
'@nuxt/icons',
'@nuxt/content'
]
})
Note: Register
@nuxt/contentafter@nuxt/uito ensure prose components work correctly Nuxt UI Content Integration.
2. Set Up Content Directory
Create a content/ directory in your project root and add your Markdown files (e.g., content/index.md, content/docs/intro.md). Nuxt Content will automatically parse these files and make them available for querying and rendering Nuxt Content Directory Structure.
3. Create Pages and Layouts
-
Layouts:
Create a layout inapp/layouts/default.vue:<template> <div> <AppHeader /> <slot /> <AppFooter /> </div> </template> -
Pages:
Use a catch-all route to render Markdown content dynamically:app/pages/[...slug].vue:<script lang="ts" setup> const route = useRoute() const { data: page } = await useAsyncData(route.path, () => { return queryCollection('content').path(route.path).first() }) </script>
<template>
<div>
<ContentRenderer v-if="page" :value="page" />
<div v-else>Page not found</div>
</div>
</template>
[Nuxt Content Rendering](<https://nuxt.com/docs/4.x/guide/directory-structure/content>)
---
### 4. **Add Nuxt Studio for Visual Editing & Permissions**
To enable editing content with user permissions, use [Nuxt Studio](<https://content.nuxt.com/studio>):
- Go to [nuxt.studio](<https://nuxt.studio>) and log in with GitHub or Google.
- Import your Nuxt Content repository (must be on GitHub).
- Invite team members and manage permissions via Studio.
- Editors can visually edit Markdown, YAML, and JSON files, and changes are synced to your GitHub repo [Nuxt Studio Setup](<https://content.nuxt.com/docs/studio/setup>).
---
### 5. **Use Nuxt UI Components for a Docs Layout**
Leverage Nuxt UI’s `UPage`, `UContentNavigation`, and `UContentToc` components for a documentation layout:
```vue
<template>
<UPage>
<template #left>
<UPageAside>
<UContentNavigation :navigation="navigation" />
</UPageAside>
</template>
<UPageHeader :title="page.title" :description="page.description" />
<UPageBody>
<ContentRenderer :value="page" />
<USeparator />
<UContentSurround :surround="surround" />
</UPageBody>
<template #right>
<UContentToc :links="page.body.toc.links" />
</template>
</UPage>
</template>
6. Start with a Template
For a quick start, you can use the Docus template, which is a ready-to-use documentation starter built with Nuxt 4, Nuxt Content, Nuxt UI, and Studio integration. It includes layouts, navigation, search, and editing out of the box.
Summary:
- Install and configure Nuxt Content, UI, and Icons.
- Organize your Markdown files in the
content/directory. - Use layouts and dynamic pages to render content.
- Enable collaborative editing and permissions with Nuxt Studio.
- Use Nuxt UI components for a professional docs layout.
- Optionally, start with the Docus template for a full-featured docs site.
For more details, see the Nuxt Content documentation and Nuxt Studio setup guide.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@proven zenith Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@digital jacinth how can i set the defualt design for the content? everthing is among each other
Let me check the knowledge base for you again. One moment! :books:
To set a default design (typography, spacing, etc.) for your Nuxt Content, you should use the Nuxt UI module, which provides beautiful and consistent styling for all prose (Markdown-rendered) components. When you use Nuxt UI with Nuxt Content, your Markdown content is automatically styled with proper spacing, headings, lists, and more, so elements are not bunched together.
How to apply default design:
-
Install and register Nuxt UI
Make sure you have@nuxt/uiinstalled and registered before@nuxt/contentin yournuxt.config.ts:export default defineNuxtConfig({ modules: [ '@nuxt/ui', '@nuxt/content' ] }) -
Use the ContentRenderer component
When you render your Markdown using<ContentRenderer :value="page" />, Nuxt UI will automatically apply its design system to all prose components, ensuring proper spacing and styling for headings, paragraphs, lists, etc.
Nuxt UI Typography Usage -
Customize the theme if needed
You can further customize the default design by overriding prose component styles in yourapp.config.ts. For example:export default defineAppConfig({ ui: { prose: { h1: { base: 'text-4xl font-bold mb-4' }, p: { base: 'mb-6 leading-7' } } } }) -
Ensure Tailwind scans your content
If you use Tailwind CSS, add the@sourcedirective in your CSS to ensure Tailwind picks up classes from your Markdown:
@import "tailwindcss";
@import "@nuxt/ui";
@source "../../../content/**/*";
Summary:
Install and configure Nuxt UI, use the ContentRenderer, and optionally customize the theme in app.config.ts. This will give your content a clean, spaced, and visually appealing default design.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@proven zenith Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@digital jacinth the @inland jewel/ui import was missing in css. How can I change the default design colors
Let me check the knowledge base for you again. One moment! :books:
To change the default design colors in Nuxt UI, you should configure the color aliases in your project. Here’s how you can do it:
-
Set Color Aliases in
app.config.ts
You can override the default semantic color aliases (likeprimary,secondary, etc.) in yourapp.config.tsfile:export default defineAppConfig({ ui: { colors: { primary: 'blue', secondary: 'purple', neutral: 'zinc' } } })This will change the default colors used by Nuxt UI components and prose styling. You can only use colors that exist in your theme (either Tailwind’s default colors or custom ones you’ve defined) Nuxt UI Design System Colors.
-
(Optional) Extend or Add Custom Colors
If you want to add new semantic colors (e.g.,tertiary), first register them in yournuxt.config.tsunder theui.theme.colorskey, then assign them inapp.config.ts:// nuxt.config.ts export default defineNuxtConfig({ ui: { theme: { colors: [ 'primary', 'secondary', 'tertiary', 'info', 'success', 'warning', 'error' ] } } }) // app.config.ts export default defineAppConfig({ ui: { colors: { primary: 'blue', secondary: 'purple', tertiary: 'indigo' } } }) -
Customize Color Shades in CSS (Optional)
If you want to override specific color shades, you can do so in yourapp/assets/css/main.cssusing the@theme staticdirective:@import "tailwindcss"; @import "@nuxt/ui";
@theme static {
--color-blue-500: #1e40af;
/* ...other custom shades */
}
[Customize Colors in Design System](<https://ui.nuxt.com/docs/getting-started/theme/design-system#colors>)
---
**Remember:**
- Always import `@nuxt/ui` in your main CSS file to ensure the styles and variables are available.
- Only use color names that exist in your Tailwind or custom theme.
This approach will update the default design colors for all Nuxt UI components and your content styling.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
@proven zenith Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@digital jacinth i've set the background color with bg-neutral-800 an it's set but it looks more like dark blue. Does ui or content override this?
Let me check the knowledge base for you again. One moment! :books:
If you set a background color using bg-neutral-800 and it appears more like dark blue, this is likely because Nuxt UI redefines the neutral color alias to use the slate color from Tailwind by default, not the classic gray. The slate palette can have a bluish tint, especially in the darker shades, which is why bg-neutral-800 may look more blue than gray.
This behavior is intentional and part of Nuxt UI's design system, as described in the migration guide and design system documentation:
-
The
graycolor has been renamed toneutral, and by default,neutralmaps toslate(Migration to v3, Design System Colors). -
You can change which Tailwind color is used for
neutralby overriding the color alias in yourapp.config.ts:export default defineAppConfig({ ui: { colors: { neutral: 'zinc' // or 'gray' if you prefer the classic gray palette } } })
Neither Nuxt UI nor Nuxt Content will override your explicit bg-neutral-800 class, but the underlying color for neutral is determined by your project's configuration. If you want a more classic gray, set neutral to zinc or gray as shown above.
Summary:
The bluish tint comes from the default mapping of neutral to slate. You can change this mapping in your config if you want a different shade for neutralMigration to v3, Design System Colors.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@proven zenith Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@digital jacinth looks like I can not use ui.colors
Vue: Object literal may only specify known properties, and colors does not exist in type Partial<ModuleOptions>
I wanna change slate to neutral
Let me check the knowledge base for you again. One moment! :books:
You are correct that the ui.colors key is not valid in nuxt.config.ts. According to the official documentation, to change which Tailwind color is used for the neutral alias (for example, from slate to zinc), you should use the following structure in your configuration files:
- In
nuxt.config.ts, you do not useui.colors. Instead, you useui.theme.colorsto define which color aliases are available:
export default defineNuxtConfig({
ui: {
theme: {
colors: [
'primary',
'secondary',
'neutral', // this is the alias, not the palette
'info',
'success',
'warning',
'error'
]
}
}
})
- To map the
neutralalias to a specific Tailwind palette (likezincinstead of the defaultslate), you must set this in yourapp.config.ts:
export default defineAppConfig({
ui: {
colors: {
neutral: 'zinc' // or 'gray', etc.
}
}
})
Summary:
- Use
ui.theme.colorsinnuxt.config.tsto define which aliases are available. - Use
ui.colorsinapp.config.tsto map an alias (likeneutral) to a Tailwind palette. - Do not use
ui.colorsinnuxt.config.ts—that will cause a type error, as you saw.