v4 Unordered list `columns()` method doesn't work
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:
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:
Expected behavior
Using ->columns() on UnorderedLists should set the number of columns as per other components.
Steps to reproduce
- Clone repo
- 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
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.
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.
I will probably get around to it some time