Skip to content

toggle: Add segmented style to ToggleGroup#2275

Merged
huacnlee merged 6 commits intolongbridge:mainfrom
suxiaoshao:issue-2272-segmented-toggle-group
Apr 23, 2026
Merged

toggle: Add segmented style to ToggleGroup#2275
huacnlee merged 6 commits intolongbridge:mainfrom
suxiaoshao:issue-2272-segmented-toggle-group

Conversation

@suxiaoshao
Copy link
Copy Markdown
Contributor

@suxiaoshao suxiaoshao commented Apr 21, 2026

Closes #2272

Description

Adds an opt-in segmented style for ToggleGroup, with configurable spacing.

This lets ToggleGroup render connected toggle items with shared outline borders and only outer rounded corners, while preserving the existing separated default style and the current Vec<bool> multi-toggle callback behavior. It also adds story and documentation coverage for the new API.

AI assistance was used to draft and implement this change; the code was reviewed against the existing ButtonGroup/ToggleGroup patterns and validated locally.

Screenshot

Before After
Segmented ToggleGroup story after

How to Test

  • cargo test -p gpui-component test_toggle_group_builder
  • cargo run

Checklist

  • I have read the CONTRIBUTING document and followed the guidelines.
  • Reviewed the changes in this PR and confirmed AI generated code (If any) is accurate.
  • Passed cargo run for story tests related to the changes.
  • Tested macOS, Windows and Linux platforms performance (if the change is platform-specific; this change is not platform-specific)

@suxiaoshao suxiaoshao marked this pull request as ready for review April 21, 2026 20:04
@huacnlee huacnlee changed the title Add segmented ToggleGroup style toggle_button: Add segmented ToggleGroup style Apr 22, 2026
@huacnlee huacnlee changed the title toggle_button: Add segmented ToggleGroup style toggle_button: Add segmented style to ToggleGroup Apr 22, 2026
@huacnlee huacnlee changed the title toggle_button: Add segmented style to ToggleGroup toggle: Add segmented style to ToggleGroup Apr 22, 2026
@huacnlee huacnlee enabled auto-merge (squash) April 22, 2026 03:38
huacnlee
huacnlee previously approved these changes Apr 22, 2026
@huacnlee huacnlee force-pushed the issue-2272-segmented-toggle-group branch from 67b7f5f to 26eb8ac Compare April 23, 2026 03:56
@huacnlee huacnlee merged commit 23e8c0c into longbridge:main Apr 23, 2026
4 checks passed
AzureZee pushed a commit to AzureZee/gpui-component that referenced this pull request Apr 23, 2026
Closes longbridge#2272

## Description

Adds an opt-in segmented style for `ToggleGroup`, with configurable
spacing.

This lets `ToggleGroup` render connected toggle items with shared
outline borders and only outer rounded corners, while preserving the
existing separated default style and the current `Vec<bool>`
multi-toggle callback behavior. It also adds story and documentation
coverage for the new API.

AI assistance was used to draft and implement this change; the code was
reviewed against the existing `ButtonGroup`/`ToggleGroup` patterns and
validated locally.

## Screenshot

| Before | After |
| ------ | ----- |
| | <img width="2930" height="1900" alt="Segmented ToggleGroup story
after"
src="https://github.com/user-attachments/assets/12bd4ae0-62e7-4e24-83c2-90bef2fe5884"
/> |

## How to Test

- `cargo test -p gpui-component test_toggle_group_builder`
- `cargo run`

## Checklist

- [x] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document and
followed the guidelines.
- [x] Reviewed the changes in this PR and confirmed AI generated code
(If any) is accurate.
- [x] Passed `cargo run` for story tests related to the changes.
- [x] Tested macOS, Windows and Linux platforms performance (if the
change is platform-specific; this change is not platform-specific)

---------

Co-authored-by: Jason Lee <huacnlee@gmail.com>
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.

Add segmented ToggleGroup style with configurable spacing

2 participants