settings: Added a way to disable a SettingItem#2383
Merged
Conversation
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.
Member
|
Thank you! |
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds the option to call
.disabled(true)on anySettingItemto 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
How to Test
I have run
cargo testwhere 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
cargo runfor story tests related to the changes.