Displaying a description with HTML tag or entity on TextColumn

is there any way to add html entity or tag inside ->description() on a table row? i have tried as following: Tables\Columns\TextColumn::make('status') ->description(fn (Tracking $record): string => \Carbon\Carbon::parse($record->date)->since() . ' ⋅ ' . $record->port->name)
Solution:
Dan Harrin
Dan Harrin264d ago
in this case, do you really need the html can you not just use the encoded version
Solution
Dan Harrin
Dan Harrin264d ago
Dan Harrin
Dan Harrin264d ago
if you're sure, wrap it in new HtmlString() but its really unnessecary also be aware that you will open yourself up to XSS, so trust the port name
KA
KA263d ago
i used the ⋅ (encoded version), just was curious to learn. Anyway, thanks for your suggestion about XSS. I am convinced to avoid to use HTML.
kakallatt
kakallatt228d ago
@Dan Harrin @KA Does v3 remove the html support in description method? This is my code, it renders html as text:
TextColumn::make('source')
->label('Source/Mode')
->formatStateUsing(fn(KeywordFinderSource $state): string => $state->headline())
->description(fn(KeywordReport $record): ?string => new HtmlString('<p class="text-2xl">' . $record->mode . '</p>'))
->html(),
TextColumn::make('source')
->label('Source/Mode')
->formatStateUsing(fn(KeywordFinderSource $state): string => $state->headline())
->description(fn(KeywordReport $record): ?string => new HtmlString('<p class="text-2xl">' . $record->mode . '</p>'))
->html(),
Dan Harrin
Dan Harrin228d ago
your return type is wrong. and please dont @ me #✅┊rules
kakallatt
kakallatt228d ago
thank you, that works. Sorry for @ you, I didn't know that.
Want results from more Discord servers?
Add your server
More Posts
Unable to use colors on blade components in livewire form componentI have created a livewire form component using docs from https://filamentphp.com/docs/3.x/forms/addiTable header actions not showing in view pageHow do you show the `headerActions` of a relation manager inside a view page resource? It only showsComponent not found after changing a ->live() elementHello, i have created a full page component which uses a form and a select live field to conditionalCustomize modal width in simple resource default create and edit actionIs it possible to change the modal width inside of resource's form static method?How to use Livewire Component in Custom Page ?Im Simply tryna use Livewire component in my filament custom page, but i get (second img) "Livewiraction method not working on a standalone ActionI have the following code and the `action` method doesn't get executed. ```php Action::make('addToCaTextColumn placeholder emptyHi! I've got an app I just upgraded from v2 to v3. I've got most of the kinks worked out, but one sCreate action in simple resource as slideoveris there a way to change in the simple resource the create action instead a modal use a slideoverCustom Page with Form BuilderHello Guys, I'm testing the Custom Page and i have a problem with the Repeater Component. It's simpSpatieMediaLibrary Image upload weirdnessI am building a user maintenance form which includes the ability to upload 3 profile images. The imgetTableRecordKey(): Return value must be of type string, nullI suddenly get this error: Filament\Resources\Pages\ListRecords::getTableRecordKey(): Return value mCreating multiple record based on other recordhow can i create a record in other table (credit) when created a record in table (payment) here alsoFileUpload not saving cropped image - v3 BUG?Hello, any file upload experts available? I'm using V3 and using fileUpload for what it is... nothiTextinput value like Placeholder content?In Placeholder::make('name')->content() I can "listen" to the other live() fields of the form and dyhow to eager load in relationship manageri have these models ```php class Company extends Model { public function events(): BelongsToManyGetting custom resource page into navigation sidebarHow to add a custom created resource page (under `Filament/ResourceName/Pages/`, not the one under `I need SelectFilter with no relationship to show null values to choose fromHello. I have a resource with a field called 'group' which is NOT a relationship and user can type wFlickeringHi, does anyone know why this keeps happening when I navigate between pages?Conditional Validating a form with a repeaterI have a form with a `select` field and a repeater with 3 other fields. The `select` element is to sHow can I make it work?I have tried to generate the condition in the second repeater but the condition does not work, what