tag component with colors?

hi any component to achieve this (attached image)?, so i can have diff color depending of the status (field on my db). any tip will be very appreciated, thank you
No description
Solution:
use a ViewField ```php ViewField::make('status') ->view('custom-status')...
Jump to solution
6 Replies
agaitan026
agaitan026OP2mo ago
how i can put that in my code? return $form ->schema([ TextInput::make('status') ->label('Status'), right now i have it as text input
Solution
LeandroFerreira
LeandroFerreira2mo ago
use a ViewField
ViewField::make('status')
->view('custom-status')
ViewField::make('status')
->view('custom-status')
<!-- resources/views/custom-status.blade.php -->
<div>
<x-filament::badge color="{{ $getState() === 'active' ? 'success' : 'danger' }}">
{{ $getState() }}
</x-filament::badge>
</div>
<!-- resources/views/custom-status.blade.php -->
<div>
<x-filament::badge color="{{ $getState() === 'active' ? 'success' : 'danger' }}">
{{ $getState() }}
</x-filament::badge>
</div>
agaitan026
agaitan026OP2mo ago
works good, how i can align that better? like the other fields
No description
LeandroFerreira
LeandroFerreira2mo ago
You can create a custom theme and customize the css using tailwind classes to achieve what you need
agaitan026
agaitan026OP2mo ago
got it, everytime i use viewfield i need a custom theme thank you
Want results from more Discord servers?
Add your server