How to increase SelectColumn width?
I have this SelectColumn in my Resource:
But the size of the select column is incredibly small. How can I make the SelectColumn wider so that it shows the text of the selected option?
Solution:Jump to solution
```php
SelectColumn::make('courier_id')
->extraAttributes(['style' => 'min-width:200px'])
->label('Courier')
->options(User::couriers()->pluck('name', 'id')),...
7 Replies
Solution
Thank you @toeknee! Do you know why the
->width()
method has no effect here?It does, but one overtakes it.
I don't follow, so this should work?
It does not work for me, what would overtake it?
I see now, but then why have a
->width()
method at all?->extraInputAttributes(['style' => 'min-width:200px'])
it will work if theres no other columns yes, but yours are re-sizing to fit it all in. So by using min-width as I showed, means it has a minimum width and will not got below that width.
For example, if you had two columns but want column 1 to be a 200px it would be, but if column2 had so much text, it would resize column 1. It's just standard css widthing.
Thank you for explaining @toeknee , and thank you for marking the solution!