Installation
Setup
Add to a Nuxt project
Install the Pohon UI package
pnpm add pohon-ui unocss @vinicunca/unocss-preset
yarn add pohon-ui unocss @vinicunca/unocss-preset
npm install pohon-ui unocss @vinicunca/unocss-preset
bun add pohon-ui unocss @vinicunca/unocss-preset
Add the Pohon UI module in your nuxt.config.ts
export default defineNuxtConfig({
modules: ['pohon-ui']
});
@nuxt/icon, @nuxt/fonts or @nuxtjs/color-mode to your modules array as Pohon UI registers them automatically. You can still configure these modules in your nuxt.config.ts using the icon, fonts and colorMode keys.Configure the UnoCSS preset
The Pohon module registers @unocss/nuxt. Create an UnoCSS configuration for the semantic utilities used by the components:
import { presetVinicunca } from '@vinicunca/unocss-preset';
import { pohonColors } from 'pohon-ui/unocss';
import { defineConfig } from 'unocss';
export default defineConfig({
presets: [
presetVinicunca()
],
theme: { colors: pohonColors },
});
Wrap your app with App component
<template>
<PApp>
<NuxtPage />
</PApp>
</template>
Explore working examples
See the Nuxt playground and Vue playground for complete Pohon UI setups.
Options
You can customize Pohon UI by providing options in your nuxt.config.ts.
prefix
Use the prefix option to change the prefix of the components.
- Default:
P
export default defineNuxtConfig({
modules: ['pohon-ui'],
css: ['~/assets/css/main.css'],
ui: {
prefix: 'Nuxt'
}
});
fonts
Use the fonts option to enable or disable the @nuxt/fonts module.
- Default:
true
export default defineNuxtConfig({
modules: ['pohon-ui'],
css: ['~/assets/css/main.css'],
ui: {
fonts: false
}
});
colorMode
Use the colorMode option to enable or disable the @nuxt/color-mode module.
- Default:
true
export default defineNuxtConfig({
modules: ['pohon-ui'],
css: ['~/assets/css/main.css'],
ui: {
colorMode: false
}
});
theme.colors
Use the theme.colors option to define the dynamic color aliases used to generate components theme.
- Default:
['primary', 'secondary', 'success', 'info', 'warning', 'error']
export default defineNuxtConfig({
modules: ['pohon-ui'],
css: ['~/assets/css/main.css'],
ui: {
theme: {
colors: ['primary', 'error']
}
}
});
error if you use forms since validation styles rely on it. primary is always included.The --ui-color-<alias>-* shades themselves are not generated: define them in your CSS (see CSS Variables).theme.transitions
Use the theme.transitions option to enable or disable transitions on components.
- Default:
true
export default defineNuxtConfig({
modules: ['pohon-ui'],
css: ['~/assets/css/main.css'],
ui: {
theme: {
transitions: false
}
}
});
transition-colors class on components with hover or active states.theme.unstyled
Use the theme.unstyled option to remove all default theme classes from components, keeping only their structure and the classes you provide through class, ui or app.config.ui.
- Default:
false
export default defineNuxtConfig({
modules: ['pohon-ui'],
css: ['~/assets/css/main.css'],
ui: {
theme: {
unstyled: true
}
}
});
Modal, Drawer or Calendar will need you to re-supply their layout, similar to PrimeVue's unstyled mode.theme.defaultVariants
Use the theme.defaultVariants option to override the default color and size variants for components.
Only defaults that are exactly primary or md are replaced, so Avatar keeps color: 'neutral' and Separator keeps size: 'xs'.
- Default:
{ color: 'primary', size: 'md' }
export default defineNuxtConfig({
modules: ['pohon-ui'],
css: ['~/assets/css/main.css'],
ui: {
theme: {
defaultVariants: {
color: 'neutral',
size: 'sm'
}
}
}
});
prose
Use the prose option to force the import of Pohon UI Prose components even if @nuxtjs/mdc, @nuxt/content or @comark/nuxt is not installed.
- Default:
false
export default defineNuxtConfig({
modules: ['pohon-ui'],
css: ['~/assets/css/main.css'],
ui: {
prose: true
}
});
content
Use the content option to force the import of the Pohon UI prose and content components even if @nuxt/content is not installed.
- Default:
false
export default defineNuxtConfig({
modules: ['pohon-ui'],
css: ['~/assets/css/main.css'],
ui: {
content: true
}
});
Continuous releases
Pohon UI uses pkg.pr.new for continuous preview releases, providing developers with instant access to the latest features and bug fixes without waiting for official releases.
Automatic preview releases are created for all commits and PRs to the main branch. Use them by replacing your package version with the specific commit hash or PR number.
{
"dependencies": {
- "pohon-ui": "^2.0.0-rc",
+ "pohon-ui": "https://pkg.pr.new/pohon-ui@4c96909",
}
}