vlang / ui

A cross-platform UI library written in V
MIT License
2.33k stars 153 forks source link

`tabs_stack` component does not properly display tabs titles #560

Closed brayevalerien closed 5 months ago

brayevalerien commented 1 year ago

Environnement

V version: V 0.4.3 d577e54 UI version: 0.0.4 OS: Windows 10

What did you do?

Here is my MWE:

import ui
import ui.component as uic

const (
    win_width  = 600
    win_height = 400
)

fn main() {
    window := ui.window(
        width: win_width
        height: win_height
        title: 'Tabs issue'
        mode: .resizable
        children: [
            uic.tabs_stack(
                id: 'tab'
                tabs: ['First tab', 'Second tab', 'Last tab']
                pages: [
                    ui.label(text: 'content of tab 1'),
                    ui.label(text: 'content of tab 2'),
                    ui.label(text: 'content of tab 3')
                ]
            ),
        ]
    )
    ui.run(window)
}

What did you expect to see?

A window with three tabs at the top, with a label on each tab with the name of the tab.

What did you see instead?

All three tabs are displayed, but their names are stacked on top of each others, in the place of the first tab. image

Additionally, it would be nice if the tab size depends on its name. So for instance 'First tab' would appear shorter than 'Second tab'. It would mean a non constant tab width.

Avocadocs commented 5 months ago

This issue has been fixed here https://github.com/vlang/ui/commit/2ba52694e777c9eecba35a076ccd4a15769230bc