Presets
Extension preset for twind providing utilities and variants that are not yet part of @twind/preset-tailwind eg Tailwind CSS.
- 🧭 Explore the examples
- 📓 Consult the API reference
- 📜 Read the changelog
📦 Installation
with @twind/core
Install from npm:
sh
npm install @twind/core @twind/preset-ext
Add the preset to your twind config:
js
import { defineConfig } from '@twind/core'
import presetExt from '@twind/preset-ext'
export default defineConfig({
presets: [presetExt()],
/* config */
})
Usage with a script tag
html
<head>
<script
src="https://cdn.jsdelivr.net/combine/npm/@twind/core@1,npm/@twind/preset-ext@1"
crossorigin
></script>
<script>
twind.install({
presets: [twind.presetExt()],
/* config */
})
</script>
</head>
with Twind CDN
html
<head>
<script src="https://cdn.twind.style/ext" crossorigin></script>
<script>
twind.install({
presets: [twind.presetExt()],
/* config */
})
</script>
</head>
🙇 Usage
Short CSS
Allows any CSS properties to be added:
html
<div class="background-color[#1da1f1]" />
↓ ↓ ↓ ↓ ↓ ↓
css
.background-color\[\#1da1f1\] {
background-color: #1da1f1;
}
When a value needs to contain a space, use an underscore (_
) instead and Twind will automatically convert it to a space at build-time 1.