Veylo Docs

HomeDocsTailwind

Tailwind

veylo.tailwind.js is the whole kit as a Tailwind v3 plugin. It is generated from veylo.css, so the markup and the look are identical to the plain CSS version. What you gain is Tailwind tokens and utilities, and theme options in your Tailwind config. The Tailwind showcase runs the same page on the plugin.

Play CDN

<script src="https://cdn.tailwindcss.com/3.4.17"></script>
<script src="https://veylo.ar0.eu/cdn/tailwind"></script>
<script>
  tailwind.config = { prefix: 'tw-', corePlugins: { preflight: false }, plugins: [veylo] };
</script>

Build setup

// tailwind.config.js
module.exports = {
  prefix: 'tw-',
  corePlugins: { preflight: false },
  plugins: [require('./veylo.tailwind.js')],
};

Two settings you need

  • preflight: false. Veylo draws its own reset, and Tailwind's would flatten the bevels.
  • prefix: 'tw-'. Veylo has its own short helper classes (flex, fixed, outline, grid). Without a prefix Tailwind's utilities of the same name would override them. With it you write tw-flex, tw-bg-face and so on.

Tokens as colours

Every theme token is a Tailwind colour, so utilities follow the active theme:

UtilityToken
tw-bg-face, tw-bg-field, tw-bg-desk, tw-bg-stripe, tw-bg-codeSurfaces
tw-text-text, tw-text-dim, tw-text-linkText
tw-text-ok, tw-text-no, tw-text-errStatus
tw-bg-acc, tw-from-acc-a, tw-to-acc-bAccent and gradient ends
tw-bg-b1 to tw-bg-b4, tw-border-ruleBevel tones and rules

Bevels as shadows

shadow-raiseshadow-sink
UtilityUse
tw-shadow-raiseButtons, windows (two-pixel bevel out)
tw-shadow-sinkInputs, wells (two-pixel bevel in)
tw-shadow-flat-raise, tw-shadow-flat-sinkOne-pixel versions
tw-shadow-etchEtched divider line
tw-shadow-boxThin outline
<div class="tw-bg-face tw-shadow-raise tw-p-3">
  <input class="tw-bg-field tw-shadow-sink tw-px-2">
</div>

Tuning the plugin

Use veylo.with() instead of the bare plugin to change themes and tokens from config:

plugins: [veylo.with({
  default: 'midnight',                                   // theme used when no data-theme is set
  themes: { graphite: { acc: '#e11d48', 'acc-b': '#fb7185' } },   // override tokens, no leading --
  vars: { fs: '14px', measure: '70rem' },                // global tokens on .veylo
})]

Regenerating

The plugin is built from veylo.css by tools/build-tailwind.mjs (needs postcss and postcss-js at build time only). Edit the CSS, run the script, and the plugin and the Tailwind showcase update together.