[GH-ISSUE #805] Not fill the full width/height in a layout #587

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

Originally created by @tcurdt on GitHub (Jan 31, 2023).
Original GitHub issue: https://github.com/rivo/tview/issues/805

I am struggling with some of the layout specifics. I created this layout by using multiple flex layouts.

Screenshot 2023-01-31 at 01 36 06

Which was quite straight forward. But this way I can only configure ratios.

The dropdowns are filling a full cell while they should only stay at their intrinsic size. Same goes for the button that is way too big. It's fine for the List to fill the available space, but all other controls should not.

The right side looks like this:

	layout := tview.NewFlex().SetDirection(tview.FlexRow)

	dropdown := tview.NewDropDown().
		SetLabel("Select: ").
		SetOptions([]string{
			"First",
			"Second",
			"Third",
			"Fourth",
			"Fifth",
		}, nil)
	dropdown.SetBorder(true)

	button := tview.NewButton("Run")
	button.SetBorder(true)

	layout.AddItem(dropdown, 0, 2, false)
	layout.AddItem(button, 0, 1, false)

I have the feeling I am missing something.

Did I miss something in the docs?
Could you give me some pointers?

Originally created by @tcurdt on GitHub (Jan 31, 2023). Original GitHub issue: https://github.com/rivo/tview/issues/805 I am struggling with some of the layout specifics. I created this layout by using multiple flex layouts. <img width="1325" alt="Screenshot 2023-01-31 at 01 36 06" src="https://user-images.githubusercontent.com/13697/215628719-cdd25423-6f21-4090-bd0c-de7ddbdaa2e0.png"> Which was quite straight forward. But this way I can only configure ratios. The dropdowns are filling a full cell while they should only stay at their intrinsic size. Same goes for the button that is way too big. It's fine for the List to fill the available space, but all other controls should not. The right side looks like this: ``` layout := tview.NewFlex().SetDirection(tview.FlexRow) dropdown := tview.NewDropDown(). SetLabel("Select: "). SetOptions([]string{ "First", "Second", "Third", "Fourth", "Fifth", }, nil) dropdown.SetBorder(true) button := tview.NewButton("Run") button.SetBorder(true) layout.AddItem(dropdown, 0, 2, false) layout.AddItem(button, 0, 1, false) ``` I have the feeling I am missing something. Did I miss something in the docs? Could you give me some pointers?
kerem closed this issue 2026-03-04 01:06:16 +03:00
Author
Owner

@tcurdt commented on GitHub (Jan 31, 2023):

Ahhh! Thanks for that pointer.
When I was trying with a size of 1 the control just disappeared - because the border required a minimum of 3.

But that's just for the direction of the flex.
Is there also a way for the items not to span the full width?

<!-- gh-comment-id:1409666030 --> @tcurdt commented on GitHub (Jan 31, 2023): Ahhh! Thanks for that pointer. When I was trying with a size of 1 the control just disappeared - because the border required a minimum of 3. But that's just for the direction of the flex. Is there also a way for the items not to span the full width?
Author
Owner

@tcurdt commented on GitHub (Feb 1, 2023):

As said: I did.
But it just disappeared because the border needed at least 3.

Anyway. Clear now.

<!-- gh-comment-id:1411758268 --> @tcurdt commented on GitHub (Feb 1, 2023): As said: I did. But it just disappeared because the border needed at least 3. Anyway. Clear now.
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#587
No description provided.