How to add width to TextInputColumn in a table?

I have the following type of column: TextInputColumn::make('siren_number') How can I provide it more width so the content is visible?
No description
22 Replies
Matthew
Matthew2mo ago
->limit(100) or whatever limit you want
gemini.dev
gemini.devOP2mo ago
Get this error when adding a limit(100) to TextInputColumn: Method Filament\Tables\Columns\TextInputColumn::limit does not exist.
Matthew
Matthew2mo ago
Ohhh, thats right.. 1m
gemini.dev
gemini.devOP2mo ago
Any ideas anybody?
gemini.dev
gemini.devOP2mo ago
Thank you @idk - This has worked for me: TextInputColumn::make('siren_number')->extraAttributes(['style' => 'width: 500px']),
idk
idk2mo ago
Nice!
TheDagofugo
TheDagofugo2mo ago
I have a similar problem. I want my TextInputColumn to be smaller, the options above did not solve my problem. With about 5 numbers that are visible when I put it in the input would be fine.
No description
gemini.dev
gemini.devOP4w ago
Hi @TheDagofugo, I see you're experiencing similar problem as I did. Have you tried setting the style? To something like: ->extraAttributes(['style' => 'width: 50px'])
JJSanders
JJSanders3w ago
I am having the same issue. This didn't work for me. Did you find a solution?
Tables\Columns\TextInputColumn::make('stock')
->extraAttributes(['style' => 'width: 50px'])
Tables\Columns\TextInputColumn::make('stock')
->extraAttributes(['style' => 'width: 50px'])
gemini.dev
gemini.devOP3w ago
Hi, what version of filament are you using? Also, have you tried doing a hard refresh?
JJSanders
JJSanders3w ago
The latest version of Filament and have tried to hard refresh but no luck.
gemini.dev
gemini.devOP3w ago
Could you try to set the value to something like 500px - I wonder if there is a min width set.
JJSanders
JJSanders3w ago
500px does change its width. But if I try for example 50 or 20 nothing happens. When I look at the computed styles there is no min-width set.
gemini.dev
gemini.devOP3w ago
Which element are you inspecting? Because it's not the input you should be inspecting, it's the container that is wrapping the input or the container before it. Set the width to something like 27px and find the div that has a width set to that. Once you find the element, you should then see if it has a min-width.
JJSanders
JJSanders3w ago
It looks like i am inspecting the wrong div. However how can I change the width of the parent div using extraAttributes
No description
gemini.dev
gemini.devOP3w ago
That looks like Tailwind class. I think what you can do is something like:
->extraAttributes(['style' => 'width: 20px', 'class' => 'min-w-20'])
->extraAttributes(['style' => 'width: 20px', 'class' => 'min-w-20'])
However, I doubt that might work - as you may to remove the original class that is there. How you do that, I'm not sure I'm afraid. I'd suggest raising a new post, someone with better knowledge within this area may assist you.
JJSanders
JJSanders3w ago
Well, this seems to work
JJSanders
JJSanders3w ago
No description
JJSanders
JJSanders3w ago
Much better
gemini.dev
gemini.devOP3w ago
Is that adding 'class' => 'min-w-20'?
JJSanders
JJSanders2w ago
Yes it is I have to come back on this. It doesn't work. I have seen it working last sunday but now not anymore. I still have:
Tables\Columns\TextInputColumn::make('stock')
->extraAttributes(['style' => 'width: 20px', 'class' => 'min-w-20'])
->label('Voorraad')
->sortable(),
Tables\Columns\TextInputColumn::make('stock')
->extraAttributes(['style' => 'width: 20px', 'class' => 'min-w-20'])
->label('Voorraad')
->sortable(),

Did you find this page helpful?