Plugins
UnoCSS
UnoCSS integration for atomic CSS styling.
UnoCSS
Integrates UnoCSS for atomic CSS styling in Manic. An alternative to Tailwind CSS with more flexibility.
Installation
bun add @manicjs/unocssQuick Start
1. Add the Plugin
// manic.config.ts
import { } from 'manicjs/config';
declare function (?: <string, unknown>): { : string };
export default ({
: [()],
});The unocss() plugin takes no options. It registers bun-plugin-unocss which auto-detects your UnoCSS configuration from the project root.
2. Create uno.config.ts
All UnoCSS configuration lives in uno.config.ts at your project root:
// uno.config.ts
declare function (: <string, unknown>): { : any[] };
declare function (): { : string };
declare function (?: <string, unknown>): { : string };
export default ({
: [
(),
(),
],
});UnoCSS Presets
Core Presets
// uno.config.ts
declare function (: <string, unknown>): { : any[] };
declare function (): { : string };
declare function (?: <string, unknown>): { : string };
declare function (): { : string };
export default ({
: [
(), // Core utilities
(), // Icon set
(), // Google Fonts
],
});Attributify Mode
// uno.config.ts
declare function (: <string, unknown>): unknown;
declare function (): unknown;
declare function (?: <string, unknown>): unknown;
export default ({
: [
(),
({
/* attributify options */
}),
],
});Then use in JSX:
<>
< class="flex gap-2" /> < flex /> {/* attributify */} < /> {/* color shortcuts */}
</>Custom Rules
// uno.config.ts
declare function (: <string, unknown>): unknown;
declare function (): unknown;
export default ({
: [()],
: [
[/^text-(.*)$/, ([]: [string]) => ({ : })],
['custom-shadow', { 'box-shadow': '0 4px 6px rgba(0,0,0,0.1)' }],
],
});Shortcuts
Define reusable class combinations:
// uno.config.ts
declare function (: <string, unknown>): unknown;
declare function (): unknown;
export default ({
: [()],
: [
['btn', 'px-4 py-2 rounded bg-blue-500 text-white hover:bg-blue-600'],
['input-field', 'w-full px-3 py-2 border border-gray-300 rounded'],
],
});Usage:
<>
< class="btn">Click</> < class="input-field" /></>Icon Sets
// uno.config.ts
declare function (: <string, unknown>): unknown;
declare function (): unknown;
declare function (?: <string, unknown>): unknown;
export default ({
: [
(),
({
: 1.2,
: 'https://esm.sh/',
}),
],
});<>
< class="i-carbon-sun text-xl" /> < class="i-carbon-moon text-xl" /></>Theme Integration
// uno.config.ts
declare function (: <string, unknown>): unknown;
declare function (): unknown;
export default ({
: [()],
: {
: {
: '#3b82f6',
: '#8b5cf6',
},
},
});Vs Tailwind CSS
| Feature | UnoCSS | Tailwind CSS |
|---|---|---|
| Bundle size | Smaller (atomic only) | Full framework |
| Customization | More flexible | Fixed methodology |
| Icon system | Built-in | Requires plugin |
| Attributify mode | Native | No |
| Virtual modules | Yes | No |
See Also
- Tailwind CSS - Alternative styling
- UnoCSS Docs