Set label property

This commit is contained in:
brabli
2025-02-26 10:46:04 +00:00
parent eebd38d17f
commit b25bbfd33c

View File

@@ -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));
}