• Stars
    star
    118
  • Rank 299,923 (Top 6 %)
  • Language
    PHP
  • License
    MIT License
  • Created about 2 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A custom table column that supports prefixed and suffixed badges to the column content.

Filament Badgeable Column

Latest Version on Packagist Total Downloads

badgeable-column-og

With Filament Badgeable Column you prepend and append badges to your columns.

Installation

You can install the package via composer:

composer require awcodes/filament-badgeable-column

In an effort to align with Filament's theming methodology you will need to use a custom theme to use this plugin.

Note If you have not set up a custom theme and are using a Panel follow the instructions in the Filament Docs first. The following applies to both the Panels Package and the standalone Forms package.

Add the plugin's views to your tailwind.config.js file.

content: [
    '<path-to-vendor>/awcodes/filament-badgeable-column/resources/**/*.blade.php',
]

Usage

use Awcodes\FilamentBadgeableColumn\Components\Badge;
use Awcodes\FilamentBadgeableColumn\Components\BadgeableColumn;

return $table
    ->columns([
        BadgeableColumn::make('name')
            ->suffixBadges([
                Badge::make('hot')
                    ->label('Hot')
                    ->color('danger')
                    ->visible(fn(Model $record) => $record->qty < 5),
            ])
            ->prefixBadges([
                Badge::make('brand_name')
                    ->label(fn(Model $record) => $record->status)
                    ->color(function(Model $record) {
                        return match ($record->status) {
                            'active' => 'success',
                            'inactive' => 'danger',
                            default => 'warning',
                        };
                    })
            ])
    ]);

You can also define the array of badges via a closure, if you want the array of badges to be based on dynamic data. The closure should return an array of Badge objects, similar to above.

The example below assumes the records have a BelongsToMany relationship called topics, and shows how to display each topic name as a badge.

use Awcodes\FilamentBadgeableColumn\Components\Badge;
use Awcodes\FilamentBadgeableColumn\Components\BadgeableColumn;

return $table
    ->columns([
        BadgeableColumn::make('title')
            ->suffixBadges(function($record) {
                  return $record->topics->map(function($topic) {
                    return Badge::make($topic->name)->color($topic->color);
                  });
            })
            ->searchable()
            ->sortable(),
    ]);

Badgeable Tags Column

Warning The Badgeable Tags Column has been deprecated please use the TextColumn badge() method instead.

Badge Shape

If you prefer to have a more "rounded" shape you can use the asPills() method to set the shape of the badges.

use Awcodes\FilamentBadgeableColumn\Components\Badge;
use Awcodes\FilamentBadgeableColumn\Components\BadgeableColumn;

return $table
    ->columns([
        BadgeableColumn::make('name')
            ->asPills()
    ]);

Separator

The default separator between the column text and the badges is '—'. If you would like to use a different separator, use the separator() method to set character to be used as a separator.

use Awcodes\FilamentBadgeableColumn\Components\Badge;
use Awcodes\FilamentBadgeableColumn\Components\BadgeableColumn;

return $table
    ->columns([
        BadgeableColumn::make('name')
            ->seperator(':')
    ]);

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

More Repositories

1

filament-curator

A media picker plugin for Filament Panels.
PHP
321
star
2

filament-tiptap-editor

A Rich Text Editor plugin for Filament Forms.
PHP
275
star
3

filament-table-repeater

A modified version of the Filament Forms Repeater to display it as a table.
PHP
199
star
4

filament-quick-create

Plugin for Filament Panels that adds a dropdown menu to the header to quickly create new items.
PHP
165
star
5

overlook

An app overview widget for Filament panels.
PHP
158
star
6

drop-in-action

A form component for Filamentphp allowing actions inside of forms.
PHP
86
star
7

alpine-floating-ui

Add Floating UI functionality to Alpine 3.x components.
JavaScript
79
star
8

filament-sticky-header

A Filament Panels plugin to make headers sticky when scrolling.
PHP
60
star
9

shout

A simple inline contextual notice for Filament forms, basically just a fancy placeholder.
PHP
50
star
10

scribble

PHP
43
star
11

filament-versions

A mostly useless package to display framework versions on Filament panels.
PHP
40
star
12

filament-addons

A set of components / fields to extend Filament Admin.
PHP
30
star
13

light-switch

Plugin to add theme switching (light/dark/system) to the auth pages for Filament Panels.
PHP
29
star
14

filament-extras

PHP
28
star
15

filament-gravatar

Replace Filament's default avatar url provider with one for Gravatar.
PHP
26
star
16

recently

Easily track and access recently viewed records in your filament panels.
PHP
22
star
17

repro

CLI tool for quickly recreating reproduction repos locally.
PHP
18
star
18

preset-color-picker

A color picker field for Filament Forms that uses preset color palettes.
PHP
17
star
19

Matinee

OEmbed field for Filament Panel and Form Builders.
PHP
17
star
20

filament-installer

Filament Admin Panel application installer.
PHP
16
star
21

html-faker

A better html faker.
PHP
13
star
22

trov

A Laravel / Filament starter kit for CMS functionality on websites.
PHP
11
star
23

hydro

CLI for creating new Filament plugins
PHP
9
star
24

filament-plugin-purge

A purge tool to keep your Filament plugin from bloating / duplicating Filament's default styles.
CSS
9
star
25

palette

A color picker field for Filament Forms that uses preset color palettes.
PHP
8
star
26

pounce

A global modal/dialog plugin for Filament.
PHP
7
star
27

filament-sentry

A basic auth scaffolding for Filament utilizing Filament Breezy, Filament Shield and custom User Resources.
PHP
7
star
28

filament-oembed

PHP
6
star
29

sink

A collection of components for Filament.
PHP
6
star
30

curator

PHP
4
star
31

translation-field

A form component for Filament to handle translations at the field / input level.
PHP
3
star
32

postal-codes

This is a package to easily install and use postal codes in your Laravel application from GeoNames.org
PHP
3
star
33

tiptap-demo

Project for testing tiptap functionality
PHP
3
star
34

assistant

A collection of helpers for use in Laravel projects.
PHP
2
star
35

dimmer

Blade
2
star
36

trov-components

A set of components, fields and layouts to extend Filament Admin.
PHP
2
star
37

awcodes-astro

Astro
2
star
38

filament-skins

PHP
2
star
39

gtm

Easy integration of Google Tag Manager into your Laravel application.
PHP
2
star
40

trov-installer

PHP
1
star
41

colors-experiment

PHP
1
star
42

pluginshot

AWcodes Plugin Screenshot Generator
PHP
1
star
43

headings

A Custom Form Component to demo building a standalone Forms Builder plugin for Filament
PHP
1
star
44

laravel-remix

Revert a new Laravel application to Laravel Mix.
PHP
1
star
45

trov-filament

PHP
1
star