plakart/contao-css-utilities

Tailwind-style spacing utility classes assignable to Contao content elements, articles and form fields

Maintainers

Package info

github.com/plakart/contao-css-utilities

Type:contao-bundle

pkg:composer/plakart/contao-css-utilities

Transparency log

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

1.0.0 2026-07-21 10:23 UTC

This package is auto-updated.

Last update: 2026-07-22 06:35:12 UTC


README

Tailwind-style spacing utility classes for Contao 5. Editors assign margins and paddings to content elements, articles, and form fields via four select fields — no CSS knowledge required.

How it works

  • 52 fixed classes: mt-0…12, mb-0…12, pt-0…12, pb-0…12
  • Values are fluid (clamp()) and defined as CSS custom properties --pcu-space-1…--pcu-space-12, so a theme can override the scale without renaming classes
  • On save, the selected classes are merged into the element's CSS class (cssID / class); manually added classes are preserved
  • utilities.css is loaded automatically on every page; each page layout has a "Disable utility CSS" checkbox to opt out

Installation

composer require plakart/contao-css-utilities

Then run the Contao install tool / migrations to add the new database columns.

The four utility fields are excluded by default — grant them to non-admin user groups in the Contao backend permissions before the selects appear.

Overriding the scale

Define the custom properties in your theme after utilities.css is loaded:

:root {
    --pcu-space-4: 1.25rem;
}

Development

composer test          # PHPUnit
composer phpstan       # static analysis
composer cs-fix        # code style
composer generate-css  # regenerate public/css/utilities.css (never edit by hand)