PHPackages                             tobimori/kirby-tailwind-merge - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. tobimori/kirby-tailwind-merge

ActiveKirby-plugin[Utility &amp; Helpers](/categories/utility)

tobimori/kirby-tailwind-merge
=============================

Tailwind Merge for Kirby CMS

4.0.0(2mo ago)276.3k↑41.7%2MITPHPPHP &gt;=8.3.0

Since Jun 17Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/tobimori/kirby-tailwind-merge)[ Packagist](https://packagist.org/packages/tobimori/kirby-tailwind-merge)[ GitHub Sponsors](https://github.com/tobimori)[ RSS](/packages/tobimori-kirby-tailwind-merge/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (6)Versions (7)Used By (0)

[![Kirby Tailwind Merge Banner](.github/banner.png)](.github/banner.png)

Kirby Tailwind Merge
====================

[](#kirby-tailwind-merge)

Intelligently merge Tailwind CSS v4 classes without style conflicts in your Kirby templates.

[![Example for Tailwind Merge](.github/example.png)](.github/example.png)

This plugin relies on [tailwind-merge-php by Tales from a Dev](https://github.com/tales-from-a-dev/tailwind-merge-php) for merging classes and only adapts it to work in the "Kirby ecosystem". Any issues related to merging classes should probably reported over there.

Installation
------------

[](#installation)

```
composer require tobimori/kirby-tailwind-merge

```

Usage
-----

[](#usage)

This plugin provides helper functions to use in your templates.

### `attr()`

[](#attr)

This helper function works similar to the Kirby built-in `attr()` function and overwrites it to support Tailwind Merge behaviour for the `class` attribute.

You'll need to disable the built-in `attr()` helper at the top-most location in your `index.php` file - before Kirby is loaded.

```
define("KIRBY_HELPER_ATTR", false);
```

#### Example

[](#example)

```
// site/snippets/component.php
