Adding a "show more/less" toggle to long description in infolist

I have an infolist with a description TextEntry component that renders HTML. However some of the descriptions are quite long, so I would like to include a toggle button saying "show more" or "show less" to expand and shrink the content.

public function infolist(Infolist $infolist): Infolist
{
return $infolist
->record($this->product)
->schema(
TextEntry::make('description')
->html(),
);
}

public function infolist(Infolist $infolist): Infolist
{
return $infolist
->record($this->product)
->schema(
TextEntry::make('description')
->html(),
);
}
1 Reply