[GH-ISSUE #289] Padding dropdown text? #223

Closed
opened 2026-03-04 01:03:07 +03:00 by kerem · 2 comments
Owner

Originally created by @mikeschinkel on GitHub (Jun 3, 2019).
Original GitHub issue: https://github.com/rivo/tview/issues/289

Is there a simple way to pad the dropdown text so that the dropdowns are wider than the widest element? Dropdowns feel a bit cramped when their text is has no padding in the drop down.

I have found that I can add the spaces to either side of the literal dropdown text and then after the users has entered values into a form trim them but it feel really hacky to do that.

Also, it would be nice if the highlight could always stretch the full width of the drop down no matter what the length of the option text currently is.

I looked at creating a pull request for this but I can see that it might be implemented more than one way so don't want to do it the way you would not prefer, but will be happy to with guidance.

Originally created by @mikeschinkel on GitHub (Jun 3, 2019). Original GitHub issue: https://github.com/rivo/tview/issues/289 Is there a simple way to pad the dropdown text so that the dropdowns are wider than the widest element? Dropdowns feel a bit cramped when their text is has no padding in the drop down. I have found that I can add the spaces to either side of the literal dropdown text and then after the users has entered values into a form trim them but it feel really hacky to do that. Also, it would be nice if the highlight could always stretch the full width of the drop down no matter what the length of the option text currently is. I looked at creating a pull request for this but I can see that it might be implemented more than one way so don't want to do it the way you would not prefer, but will be happy to with guidance.
kerem closed this issue 2026-03-04 01:03:07 +03:00
Author
Owner

@rivo commented on GitHub (Jul 5, 2019):

My latest commit adds SetTextOptions() to the DropDown primitive. This should allow you to add some padding to the drop-down items. I also decided to stretch the selection bar to the entire width as you requested.

<!-- gh-comment-id:508703002 --> @rivo commented on GitHub (Jul 5, 2019): My latest commit adds [`SetTextOptions()`](https://godoc.org/github.com/rivo/tview#DropDown.SetTextOptions) to the `DropDown` primitive. This should allow you to add some padding to the drop-down items. I also decided to stretch the selection bar to the entire width as you requested.
Author
Owner

@mikeschinkel commented on GitHub (Jul 5, 2019):

@rivo Thank you!

<!-- gh-comment-id:508813352 --> @mikeschinkel commented on GitHub (Jul 5, 2019): @rivo Thank you!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tview#223
No description provided.