Skip to content

预设

🌐 Presets

预设是 UnoCSS 的核心。它们让你在几分钟内创建自己的自定义框架。

🌐 Presets are the heart of UnoCSS. They let you make your own custom framework in minutes.

使用预设

🌐 Using presets

为你的项目设置预设:

🌐 To set presets to your project:

uno.config.ts
ts
import { 
defineConfig
,
presetAttributify
,
presetWind3
} from 'unocss'
export default
defineConfig
({
presets
: [
presetAttributify
({ /* preset options */}),
presetWind3
(),
// ...custom presets ], })

当指定 presets 选项时,默认预设将被忽略。

🌐 When the presets option is specified, the default preset will be ignored.

要禁用默认预设,你可以将 presets 设置为空数组:

🌐 To disable the default preset, you can set presets to an empty array:

uno.config.ts
ts
import { 
defineConfig
} from 'unocss'
export default
defineConfig
({
presets
: [], // disable default preset
rules
: [
// your custom rules ], })

你可以查看官方预设社区预设以获取更多信息。

🌐 You can check official presets and community presets for more.

创建预设

🌐 Creating presets

要了解如何创建你自己的自定义预设,请参见 Config: presets

🌐 To see how you can create your own custom preset, see Config: presets.