Skip to content

Commit

Permalink
Merge pull request #126 from shafimsp/feat-support-html-for-header-label
Browse files Browse the repository at this point in the history
Support html label for Header
  • Loading branch information
awcodes authored Jul 18, 2024
2 parents da460b2 + 5673204 commit 5140e21
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Header.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Closure;
use Filament\Support\Concerns\EvaluatesClosures;
use Filament\Support\Enums\Alignment;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\Str;

class Header
Expand All @@ -13,7 +14,7 @@ class Header

final public function __construct(
public string $name,
public string | Closure | null $label = null,
public string | Htmlable | Closure | null $label = null,
public string | Closure | Alignment | null $align = null,
public string | Closure | null $width = null,
public bool | Closure | null $isRequired = null,
Expand All @@ -24,7 +25,7 @@ public static function make(string $name): static
return app(static::class, ['name' => $name]);
}

public function label(string | Closure $label): static
public function label(string | Htmlable | Closure $label): static
{
$this->label = $label;

Expand Down Expand Up @@ -52,7 +53,7 @@ public function markAsRequired(bool | Closure | null $condition = true): static
return $this;
}

public function getLabel(): string
public function getLabel(): string | Htmlable
{
return $this->evaluate($this->label)
?? (string) Str::of($this->name)->title();
Expand Down

0 comments on commit 5140e21

Please sign in to comment.