用于控制用户是否可以在元素中选择文本的功能类。
<div class="select-none ...">
This text is not selectable
</div><div class="select-text ...">
This text is selectable
</div><div class="select-all ...">
Click anywhere in this text to select it all
</div><div class="select-auto ...">
This text is selectable
</div>默认情况下, 针对 user-select 功能类,只生成 responsive 变体。
您可以通过修改您的 tailwind.config.js 文件中的 variants 部分中的 userSelect 属性来控制为 user-select 功能生成哪些变体。
例如,这个配置也将生成 hover and focus 变体:
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ userSelect: ['hover', 'focus'],
}
}
}如果您不打算在您的项目中使用 user-select 功能,您可以通过在配置文件的 corePlugins 部分将 userSelect property to false in the corePlugins section of your config file:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ userSelect: false,
}
}