Skip to content

[WIP] Fix tabs with state management in v0.5.0 - #1882

Closed
huacnlee with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-tabs-with-state-management
Closed

[WIP] Fix tabs with state management in v0.5.0#1882
huacnlee with Copilot wants to merge 1 commit into
mainfrom
copilot/fix-tabs-with-state-management

Conversation

Copilot AI commented Jan 2, 2026

Copy link
Copy Markdown
Contributor

Thanks for assigning this issue to me. I'm starting to work on it and will keep this PR's description up to date as I form a plan and make progress.

Original prompt

This section details on the original issue you should resolve

<issue_title>Tabs with State Management - Clicking the tab has no effect v0.5.0 windows 11</issue_title>
<issue_description>## Description

Use English with clear and concise description of the bug, if you just have a question or need help, please submit to Discussions.

Environment

  • GPUI: v0.2.2
  • GPUI Component: v0.5.0
  • Platform: Windows 11

Steps to Reproduce

struct TabsWithContent {
    active_tab: usize,
    tab_contents: Vec<String>,
}

impl TabsWithContent {
    fn render_tab_content(&self, cx: &mut Context<Self>) -> impl IntoElement {
        match self.active_tab {
            0 => div().child("Account content"),
            1 => div().child("Profile content"),
            2 => div().child("Settings content"),
            _ => div().child("Unknown content"),
        }
    }
}

impl Render for TabsWithContent {
    fn render(&mut self, _: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
        v_flex()
            .child(
                TabBar::new("content-tabs")
                    .selected_index(self.active_tab)
                    .on_click(cx.listener(|view, index, _, cx| {
                        view.active_tab = *index;
                        cx.notify();
                    }))
                    .child(Tab::new().label("Account"))
                    .child(Tab::new().label("Profile"))
                    .child(Tab::new().label("Settings"))
            )
            .child(
                div()
                    .flex_1()
                    .p_4()
                    .child(self.render_tab_content(cx))
            )
    }
}

Tabs with Close Buttons</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tabs with State Management - Clicking the tab has no effect v0.5.0 windows 11

2 participants