Table
TextColumn
The default cell: text with formatting presets, links, copying, descriptions and tooltips.
On this page
General-purpose text column with formatting presets.
use NyonCode\WireTable\Columns\TextColumn;
Basic Usage
TextColumn::make('name') ->sortable() ->searchable() TextColumn::make('email') ->searchable() ->copyable() ->copyMessage('Copied!') ->icon('mail')
Date/Time Formatting
// PHP date formatTextColumn::make('created_at') ->dateTime('d.m.Y H:i') ->sortable() // Date onlyTextColumn::make('birth_date') ->date('j. F Y') // Relative timeTextColumn::make('last_login') ->since() // "2 hours ago", "3 days ago" ->sortable() ->tooltip(fn ($r) => $r->last_login?->format('d.m.Y H:i:s'))
Money Formatting
TextColumn::make('price') ->money('CZK') // "1 234,50 CZK" ->sortable() ->alignRight() TextColumn::make('salary') ->money('USD') // "$1,234.50" ->summarize('sum', 'Total')
Numeric Formatting
TextColumn::make('quantity') ->numeric( decimals: 0, thousandsSeparator: ' ' ) ->alignRight() ->sortable() TextColumn::make('percentage') ->numeric(decimals: 1) ->suffix('%')
Font Family
TextColumn::make('code') ->fontFamily('mono') // monospace font TextColumn::make('quote') ->fontFamily('serif')
Rich Content with Mentions
Stored editor content whose mentions are read back from the database on every render, so a renamed record reads renamed in the table too:
TextColumn::make('body') ->richContent() // implies ->html() ->limit(120)
Implies html(), because resolved mentions are markup — this is not
a second raw-HTML switch, it is what to do with the identities such markup holds.
Without it a mention shows the name it was written with, which is quietly wrong
rather than visibly broken.
It costs queries per row. A cell is rendered on its own, so mentions batch within one cell and not across the page: twenty-five rows are twenty-five lookups. Worth it on a narrow table of documents; not worth it on a listing that only shows the first eighty characters, where
limit()on plain text says the same thing for free.
Complete TextColumn API
->date(?string $format = null) // date formatting->dateTime(?string $format = null) // datetime formatting->since() // relative time (diffForHumans)->money(string $currency) // currency formatting->numeric(int $decimals = 0, ?string $decimalSeparator = ',', ?string $thousandsSeparator = ' ')->fontFamily(string $family) // 'sans', 'serif', 'mono'->richContent(bool $condition = true) // resolve mentions; implies ->html()->isRichContent(): bool->isMoney(): bool->getCurrency(): ?string->isNumeric(): bool