docs(app): enable support for @nuxt/ui-pro with vue (#3191)

Co-authored-by: Benjamin Canac <canacb1@gmail.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Farnabaz <farnabaz@gmail.com>
This commit is contained in:
Hugo Richard
2025-02-26 19:00:45 +01:00
committed by GitHub
parent b53f77b304
commit 2cb4bd8a72
7 changed files with 176 additions and 17 deletions

View File

@@ -96,7 +96,7 @@ export default defineAppConfig(${json5.stringify(component.value, null, 2).repla
::
::code-collapse{class="vue-only"}
::code-collapse{class="vue-only ui-only"}
\`\`\`ts [vite.config.ts]
import { defineConfig } from 'vite'
@@ -116,6 +116,26 @@ export default defineConfig({
::
::code-collapse{class="vue-only ui-pro-only"}
\`\`\`ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import uiPro from '@nuxt/ui-pro/vite'
export default defineConfig({
plugins: [
vue(),
uiPro(${json5.stringify(component.value, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')
.split('\n')
.map((line, i) => i === 0 ? line : ` ${line}`)
.join('\n')})
]
})
\`\`\`
::
${strippedCompoundVariants.value
? `
::callout{icon="i-simple-icons-github" to="${themeLink.value}" title="Compound variants"}

View File

@@ -31,11 +31,7 @@ export default defineAppConfig(${json5.stringify({
::
::caution{class="ui-pro-only vue-only"}
Nuxt UI Pro v3 does not support Vue yet.
::
::code-collapse{class="vue-only"}
::code-collapse{class="vue-only ui-only"}
\`\`\`ts [vite.config.ts]
import { defineConfig } from 'vite'
@@ -57,6 +53,30 @@ export default defineConfig({
})
\`\`\`
::
::code-collapse{class="vue-only ui-pro-only"}
\`\`\`ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import uiPro from '@nuxt/ui-pro/vite'
export default defineConfig({
plugins: [
vue(),
uiPro(${json5.stringify({
ui: {
icons
}
}, null, 2).replace(/,([ |\t\n]+[}|\])])/g, '$1')
.split('\n')
.map((line, i) => i === 0 ? line : ` ${line}`)
.join('\n')})
]
})
\`\`\`
::
`

View File

@@ -9,7 +9,6 @@ export function useSharedData() {
label: 'Vue',
icon: 'i-simple-icons-vuedotjs',
value: 'vue',
disabled: module.value === 'ui-pro',
onSelect: () => {
if (module.value === 'ui-pro') {
return
@@ -29,7 +28,6 @@ export function useSharedData() {
label: 'UI Pro',
icon: 'i-lucide-panels-top-left',
value: 'ui-pro',
disabled: framework.value === 'vue',
onSelect: () => {
if (framework.value === 'vue') {
return

View File

@@ -159,7 +159,9 @@ export default defineAppConfig({
::
#vue
::div
::module-only
#ui
:::div
You can configure these color aliases at runtime in your `vite.config.ts` file under the `ui.colors` key:
```ts [vite.config.ts]
@@ -181,6 +183,31 @@ export default defineConfig({
]
})
```
:::
#ui-pro
:::div
You can configure these color aliases at runtime in your `vite.config.ts` file under the `uiPro.colors` key:
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import uiPro from '@nuxt/ui-pro/vite'
export default defineConfig({
plugins: [
vue(),
uiPro({
ui: {
colors: {
primary: 'blue',
neutral: 'zinc'
}
}
})
]
})
```
:::
::
@@ -229,6 +256,8 @@ export default defineNuxtConfig({
:::
#vue
::module-only
#ui
:::tip
You can add you own dynamic color aliases in your `vite.config.ts`, you just have to make sure to also define them in the [`theme.colors`](/getting-started/installation/vue#themecolors) option of the `ui` plugin.
@@ -255,6 +284,36 @@ export default defineConfig({
```
:::
#ui-pro
:::tip
You can add you own dynamic color aliases in your `vite.config.ts`, you just have to make sure to also define them in the [`theme.colors`](/getting-started/installation/vue#themecolors) option of the `uiPro` plugin.
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import uiPro from '@nuxt/ui-pro/vite'
export default defineConfig({
plugins: [
vue(),
uiPro({
ui: {
colors: {
tertiary: 'indigo'
},
},
theme: {
colors: ['primary', 'secondary', 'tertiary', 'info', 'success', 'warning', 'error']
}
})
]
})
```
:::
::
::
### Tokens
@@ -788,7 +847,10 @@ export default defineAppConfig({
::
#vue
::div
::module-only
#ui
:::div
You can override the theme of components globally inside your `vite.config.ts` by using the exact same structure as the theme object.
Let's say you want to change the font weight of all your buttons, you can do it like this:
@@ -813,7 +875,35 @@ export default defineConfig({
]
})
```
:::
#ui-pro
:::div
You can override the theme of components globally inside your `vite.config.ts` by using the exact same structure as the theme object.
Let's say you want to change the font weight of all your buttons, you can do it like this:
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import uiPro from '@nuxt/ui-pro/vite'
export default defineConfig({
plugins: [
vue(),
uiPro({
ui: {
button: {
slots: {
base: 'font-bold'
}
}
}
})
]
})
```
:::
::
::

View File

@@ -32,6 +32,9 @@ const mode = useColorMode()
You can disable this plugin with the `colorMode` option in your `vite.config.ts`:
::module-only
#ui
:::div
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
@@ -46,3 +49,24 @@ export default defineConfig({
]
})
```
:::
#ui-pro
:::div
```ts [vite.config.ts]
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import uiPro from '@nuxt/ui-pro/vite'
export default defineConfig({
plugins: [
vue(),
uiPro({
colorMode: false
})
]
})
```
:::
::

View File

@@ -10,7 +10,7 @@
"@nuxt/content": "^3.2.2",
"@nuxt/image": "^1.9.0",
"@nuxt/ui": "latest",
"@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@2b867b3",
"@nuxt/ui-pro": "https://pkg.pr.new/@nuxt/ui-pro@c02527f",
"@nuxthub/core": "^0.8.17",
"@nuxtjs/plausible": "^1.2.0",
"@octokit/rest": "^21.1.1",