filament icon indicating copy to clipboard operation
filament copied to clipboard

v4 Unordered list `columns()` method doesn't work

Open binaryfire opened this issue 5 months ago • 3 comments

Package

filament/filament

Package Version

4-beta13

Laravel Version

12

Livewire Version

3

PHP Version

8.4

Problem description

The ->columns() method doesn't do anything on the UnorderedList component at the moment. This:

UnorderedList::make([
    Text::make('Lorem ipsum'),
    Text::make('Dolor sit amet'),
    Text::make('Consectetur adipiscing'),
    Text::make('Sed do eiusmod'),
    Text::make('Tempor incididunt'),
    Text::make('Ut labore et dolore'),
    Text::make('Magna aliqua'),
    Text::make('Ut enim ad minim'),
    Text::make('Veniam quis nostrud'),
    Text::make('Exercitation ullamco'),
])
->columns(1),

Results in this:

Image

Currently you have to use extraAttributes() to force it:

UnorderedList::make([
    Text::make('Lorem ipsum'),
    Text::make('Dolor sit amet'),
    Text::make('Consectetur adipiscing'),
    Text::make('Sed do eiusmod'),
    Text::make('Tempor incididunt'),
    Text::make('Ut labore et dolore'),
    Text::make('Magna aliqua'),
    Text::make('Ut enim ad minim'),
    Text::make('Veniam quis nostrud'),
    Text::make('Exercitation ullamco'),
])
->extraAttributes(['style' => 'columns: 1 !important;'])

Result: Image

Expected behavior

Using ->columns() on UnorderedLists should set the number of columns as per other components.

Steps to reproduce

  1. Clone repo
  2. Go to "Unordered List Columns" page

Reproduction repository (issue will be closed if this is not valid)

https://github.com/binaryfire/filament-bug-reproduction

Relevant log output


binaryfire avatar Jul 05 '25 09:07 binaryfire

The columns() method is not a feature of the unordered list component, it is just on the base Component class so gets inherited. I just didn't need it for the use case I was doing. Would accept a PR to make it work, but would probably be a slight breaking change as the default would change from 2 to 1, so you'd need to update any existing usages.

danharrin avatar Jul 05 '25 16:07 danharrin

Just realised the existing columns logic is specifically for grids, which this isn't. The only solutions I could come up with are pretty messy so I'll stick with ->extraAttributes(). Thanks.

binaryfire avatar Jul 06 '25 01:07 binaryfire

I will probably get around to it some time

danharrin avatar Jul 06 '25 02:07 danharrin