© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•16mo ago•
3 replies
Xiaohou

Badge color doesn't update using Enum status

For text column inside table builder, when using a badge() with status casted from Enum, the color doesnt change when the status change.

For example, when then
status
status
value is changed from
activated
activated
to
deactivated
deactivated
via form, the text inside badge will update to the getLabel() value, however, the color of the badge doesnt update.


The text column code:
Tables\Columns\TextColumn::make('status'),
Tables\Columns\TextColumn::make('status'),


The enum status code:
<?php

namespace App\Enums;

use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum UserStatus: string implements HasLabel, HasColor
{
    case Activated = 'activated';
    case Deactivated = 'deactivated';

    public function getLabel(): ?string
    {
        return match ($this) {
            self::Activated => 'activated',
            self::Deactivated => 'deactivated',
        };
    }

    public function getColor(): array|string
    {
        return match ($this) {
            self::Activated => 'success',
            self::Deactivated => 'danger',
        };
    }
}
<?php

namespace App\Enums;

use Filament\Support\Contracts\HasColor;
use Filament\Support\Contracts\HasLabel;

enum UserStatus: string implements HasLabel, HasColor
{
    case Activated = 'activated';
    case Deactivated = 'deactivated';

    public function getLabel(): ?string
    {
        return match ($this) {
            self::Activated => 'activated',
            self::Deactivated => 'deactivated',
        };
    }

    public function getColor(): array|string
    {
        return match ($this) {
            self::Activated => 'success',
            self::Deactivated => 'danger',
        };
    }
}


I did make sure the status is casted to enum from my model, any help will be appreciated!
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Badge component color using hex
FilamentFFilament / ❓┊help
15mo ago
Enum TextColumn badge() with label, icon and color
FilamentFFilament / ❓┊help
3y ago
badge color from color field
FilamentFFilament / ❓┊help
2y ago