is there a formatStateUsing for IconColumn?

What I have:
I have a table with a one-to-many boolean icon column (positionData.is_active)
Currently the State is populates with all the records for example (true, false, true)

What I want to do:
I just want a single value returned.

What I have tried
If it was a TextColumn I could use something like
TextColumn::make('positionData.is_active)
->formatStateUsing(
  function ($record) {
    $isActive =  $record->positionData->sortByDesc('year')->values()->first()->is_active;
    // render stuff here ...
  }

But this doesnt seem to be a thing for IconColumns.

I've tried using the
TextColumn::make('positionData.is_active)->icon(...) 

But the format and size is totally different than the Icon Columns.

Any suggestions?
Solution
Tables\Columns\IconColumn::make('position_data_active')
    ->boolean()
    ->state(fn (YourModel $record): bool => $record
        ->positionData
        ->sortByDesc('year')
        ->first()
        ->is_active ?? false
    )

?
Was this page helpful?