Skip to content

settings: Added a way to disable a SettingItem#2383

Merged
madcodelife merged 4 commits into
longbridge:mainfrom
Libadoxon:main
May 19, 2026
Merged

settings: Added a way to disable a SettingItem#2383
madcodelife merged 4 commits into
longbridge:mainfrom
Libadoxon:main

Conversation

@Libadoxon

Copy link
Copy Markdown
Contributor

Description

This adds the option to call .disabled(true) on any SettingItem to make this item inaccessible. I showcased this with a new button in the settings story.

The first commit was assisted by Claude Code, I have reviewed all the code written by AI and to the best of my knowledge vouch for its validity.

Screenshot

2026-05-18_22:02:16- 2026-05-18_22:03:48-

How to Test

I have run cargo test where all tests passed and every example build. I also verified the behavior with the settings story, where I added a button to disable the other settings.

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)

Libadoxon added 2 commits May 18, 2026 21:30
Forwards the flag through `RenderOptions::disabled` so the built-in field
renderers (Switch, Checkbox, Dropdown Field, etc.) render as noninteractive,
and custom `SettingItem::Element` renderers can honor it themselves.
The item container is dimmed to 0.5 opacity for visual feedback.
Added a new button to showcase the disabled behavior/looks
for the different setting types.
@huacnlee huacnlee changed the title Added a way to disable a SettingItem settings: Added a way to disable a SettingItem May 19, 2026
@madcodelife

Copy link
Copy Markdown
Member

Thank you!

@madcodelife madcodelife merged commit 52e09da into longbridge:main May 19, 2026
4 checks passed
AzureZee pushed a commit to AzureZee/gpui-component that referenced this pull request May 21, 2026
## Description

This adds the option to call `.disabled(true)` on any `SettingItem` to
make this item inaccessible. I showcased this with a new button in the
settings story.

The first commit was assisted by Claude Code, I have reviewed all the
code written by AI and to the best of my knowledge vouch for its
validity.

## Screenshot
<img width="2256" height="1504" alt="2026-05-18_22:02:16-"
src="https://github.com/user-attachments/assets/1bb13b43-c222-4a2f-9751-9b2b04b203fb"
/>
<img width="2256" height="1504" alt="2026-05-18_22:03:48-"
src="https://github.com/user-attachments/assets/bd9e594d-4e4e-4535-9724-1f2fdb93e7fb"
/>


## How to Test
I have run `cargo test` where all tests passed and every example build.
I also verified the behavior with the settings story, where I added a
button to disable the other settings.

## 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.
- [ ] Tested macOS, Windows and Linux platforms performance (if the
change is platform-specific)

---------

Co-authored-by: Floyd Wang <gassnake999@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.

2 participants