From b25bbfd33c10c37bf829ca593c163e9f36948d4d Mon Sep 17 00:00:00 2001 From: brabli <67018167+brabli@users.noreply.github.com> Date: Wed, 26 Feb 2025 10:46:04 +0000 Subject: [PATCH] Set label property --- src/Twig/Component/Badge.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Twig/Component/Badge.php b/src/Twig/Component/Badge.php index 0f334c0..e6df824 100644 --- a/src/Twig/Component/Badge.php +++ b/src/Twig/Component/Badge.php @@ -13,6 +13,7 @@ use TailwindMerge\TailwindMerge; final class Badge { public string $finalClasses; + public ?string $label = null; public function __construct(private string $baseClasses) { @@ -28,6 +29,8 @@ final class Badge */ public function mount(?BadgeableInterface $obj = null, ?string $class = null, ?string $colour = null, ?string $label = null, bool $outline = false): void { + $this->label = $label; + if (!$obj && !$colour) { throw new \RuntimeException(sprintf('You must specify either a colour an instance of "%s".', BadgeableInterface::class)); }