© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•3y ago•
7 replies
Hasith

can i add action button to a stat widget?

I have this widget card. i want to add a button to it and when the user click it I want to delete a record inside the database. Is it possible to add action and how can I do that?

class WarningWidget extends BaseWidget
{
    protected static ?int $sort = -2;

    protected function getColumns(): int
    {
        return 1;
    }

    public static function canView():bool
    {

        return true;

    }

    protected function getStats(): array
    {
        return [

            Stat::make('Unknown API Request','')
            ->description('We are having unknown API request from a unregistered domain')
            ->icon('heroicon-m-exclamation-triangle')
            ->color('danger'),

        ];
    }
}
class WarningWidget extends BaseWidget
{
    protected static ?int $sort = -2;

    protected function getColumns(): int
    {
        return 1;
    }

    public static function canView():bool
    {

        return true;

    }

    protected function getStats(): array
    {
        return [

            Stat::make('Unknown API Request','')
            ->description('We are having unknown API request from a unregistered domain')
            ->icon('heroicon-m-exclamation-triangle')
            ->color('danger'),

        ];
    }
}
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

widget stat
FilamentFFilament / ❓┊help
2y ago
Widget Stat
FilamentFFilament / ❓┊help
3y ago
Add filters to stat widgets
FilamentFFilament / ❓┊help
2y ago
Add Action to custom widget
FilamentFFilament / ❓┊help
3y ago