PHPackages                             jacksleight/blade-tailor - 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. [Templating &amp; Views](/categories/templating)
4. /
5. jacksleight/blade-tailor

ActiveLibrary[Templating &amp; Views](/categories/templating)

jacksleight/blade-tailor
========================

0.3.3(1y ago)16551PHPPHP ^8.1|^8.2|^8.3

Since Oct 3Pushed 1y ago1 watchersCompare

[ Source](https://github.com/jacksleight/blade-tailor)[ Packagist](https://packagist.org/packages/jacksleight/blade-tailor)[ GitHub Sponsors](https://github.com/jacksleight)[ RSS](/packages/jacksleight-blade-tailor/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (8)Used By (0)

Blade Tailor
============

[](#blade-tailor)

Blade Tailor allows you to build blade components that can be customised (tailored) without publishing their templates. This is particularly useful when bulding a shared component library that should be customisable. It's possible to alter the default props, classes and attributes used by tailored components externally.

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

[](#installation)

Run the following command from your project root:

```
composer require jacksleight/blade-tailor
```

If you need to customise the config you can publish it with:

```
php artisan vendor:publish --tag="tailor-config"
```

Usage
-----

[](#usage)

### Making Components Tailorable

[](#making-components-tailorable)

You can make a component tailorable by replacing the `@props` directive with `@tailor`.

```
@tailor([
    'type' => 'info',
    'message',
])
class('text-blue-500') }}>
    {{ $message }}

```

### Tailoring Components

[](#tailoring-components)

Tailoring components is done via the `Tailor::component()` method. You can either make these calls in a service provider or create a dedicated file for your customisations in `resources/tailor.php` (this will be loaded automatically). Whenever you add an alteration for a brand new component you need to run `php artisan view:clear`, as the template will need to be recompiled. Further changes will not require recompiling.

```
use JackSleight\BladeTailor\Tailor;

Tailor::component('package::button')
    ->props([
        'size' => 'lg', // Customise prop defaults
        'huge' => false, // Add new props
    ])
    ->classes(fn ($variant, $huge) => [
        'border-4 rounded-full -rotate-2 !shadow-drop-1g',
        'scale-150' => $huge,
        match ($variant) {
            'primary' => 'border-blue-300',
            'danger' => 'border-red-800',
            default => '',
        },
    ]),
    ->attributes([ // Add new attributes
        'data-thing' => 'foo',
    ]);

// Target multiple components
Tailor::component(['package::*', 'other::input'])
    ->replace([ // Replace default classes
        'text-sm' => 'text-base',
    ])
    ->remove([ // Remove default classes
        'rounded',
    ])
    ->reset(true); // Remove all default classes

Tailor::component('package::card')
    ->root( // Customise root and slot elements
        classes: 'rounded-2xl',
        attributes: ['data-thing' => 'bar'],
    )
    ->slot('image',
        classes: 'rounded',
    )
    ->slot('text',
        classes: 'p-4',
    );
```

The remove, replace and reset options are not slot specific, they will apply to all slots.

You'll need to add any files where you're defining alterations to your Tailwind config's `content` array to ensure the compiler picks up the new classes:

```
content: [
    // ...
    "./resources/tailor.php",
],
```

### Using Tailwind Merge

[](#using-tailwind-merge)

This package does not require [Tailwind Merge](https://github.com/gehrisandro/tailwind-merge-laravel) as a dependency, but if it's installed it will be used when merging your custom classes with the default ones.

### Tailoring External Components

[](#tailoring-external-components)

It is possible to make non-tailorable components from external libraries tailorable as well with the intercept feature. To do that you will need to publish the config and then enable the `tailor.intercept` option.

Warning

Intercept makes some minor changes to external component templates during compilation, in order to hook into their rendering processes. These are limited to the components you're tailoring but there may be edge cases that result in unexpected behaviour.

Sponsoring
----------

[](#sponsoring)

This package is completely free to use. However fixing bugs, adding features and helping users takes time and effort. If you find this addon useful and would like to support its development any [contribution](https://github.com/sponsors/jacksleight) would be greatly appreciated. Thanks! 🙂

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance43

Moderate activity, may be stable

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~23 days

Recently: every ~29 days

Total

6

Last Release

475d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b1acb404d9801e5f633e31efa3403a4735e43ea93c798e3f895ba3264c92c6e?d=identicon)[jacksleight](/maintainers/jacksleight)

---

Top Contributors

[![jacksleight](https://avatars.githubusercontent.com/u/126740?v=4)](https://github.com/jacksleight "jacksleight (65 commits)")[![Naoray](https://avatars.githubusercontent.com/u/10154100?v=4)](https://github.com/Naoray "Naoray (1 commits)")

### Embed Badge

![Health badge](/badges/jacksleight-blade-tailor/health.svg)

```
[![Health](https://phpackages.com/badges/jacksleight-blade-tailor/health.svg)](https://phpackages.com/packages/jacksleight-blade-tailor)
```

###  Alternatives

[cagilo/cagilo

A set of open-source Blade components for the Laravel Framework

172996.5k](/packages/cagilo-cagilo)[orchid/blade-icons

An easy way inline SVG images in your Blade templates.

223.4M9](/packages/orchid-blade-icons)[wireui/heroicons

The Tailwind Heroicons for laravel blade by WireUI

43390.8k5](/packages/wireui-heroicons)[stillat/antlers-components

2656.0k1](/packages/stillat-antlers-components)[itstructure/laravel-grid-view

Grid view for laravel framework

2546.6k2](/packages/itstructure-laravel-grid-view)[ycs77/inertia-laravel-ssr-head

Simple SSR Head for Inertia Laravel

3211.5k](/packages/ycs77-inertia-laravel-ssr-head)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
