1. Presets
  2. Extensions

Presets

@twind/preset-ext

MIT License Latest Release Github

Extension preset for twind providing utilities and variants that are not yet part of @twind/preset-tailwind eg Tailwind CSS.

📦 Installation

with @twind/core

Install from npm:

sh
npm install @twind/core @twind/preset-ext

Add the preset to your twind config:

twind.config.js
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,npm/@twind/preset-ext"
    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.

Footnotes

  1. Tailwind CSS › Adding Custom Styles › Handling whitespace