input_group: Add composable input groups - #3042
Open
suxiaoshao wants to merge 5 commits into
Open
Conversation
6 tasks
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.
Closes #2863
Description
Add composable input groups for multiple inline addons, block toolbars, and textareas that share one frame. Existing
Input::prefixandInput::suffixremain available for simple standalone adornments.Composition and reuse boundary
The reusable unit is the retained
InputState/TextareaStateand its native editing engine.InputGroupdoes not compose or wrap the styledInputcomponent. It owns its layout, border, background, and focus/error treatment, while the existing state continues to own text, selection, undo, IME, focus, and textarea scrolling/auto-grow. A privateInputControladapter shares theme projection, native menus, accessibility, and content-type integration with standalone inputs without sharing their visual frame. There are nogpui-basechanges.The public API keeps the composable parts and fluent construction of shadcn/ui:
InputGroup,InputGroupInput,InputGroupTextarea,InputGroupAddon,InputGroupButton, andInputGroupText. Rust uses a typed.input(...)slot for one editor and ordered.addon(...)/.child(...)composition:Each part owns its presentation. Default styling follows the
base-novacomposition with GPUI Component theme tokens. Editor, label, icon, and semantic-state refinements expose stable customization points. The group coordinates disabled/read-only behavior and addon click-to-focus while preserving native button actions.The same six parts are registered in the JavaScript shell, with retained state bindings and immediate style declarations. Native and JavaScript Stories cover the compositions and working actions; English and Chinese documentation explain ownership, usage, and styling.
Breaking Changes
None; existing input APIs are unchanged. The following is an optional change when a simple prefix grows into a shared-frame composition:
How to Test
Validated on macOS after rebasing onto the latest upstream
main:The 25 focused regressions cover native editing, focus routing, embedded actions, disabled/read-only behavior, accessibility, selection/IME geometry, textarea padding and scrolling, shell state callbacks, and Story materialization. TypeScript positive/negative fixtures and runtime validation pass. JavaScript Story coverage tracks 72 routes and 73 catalog surfaces.
The native Input Group Story was also exercised on macOS for editing, focus, custom internal styles, and submission. Windows, Linux, and WebAssembly were not manually tested.
Checklist
Implementation, examples, documentation, and tests were developed with Codex assistance.