Repository navigation
input_group: Add InputGroup - #3042
Merged
Merged
Conversation
6 tasks
Member
Code reviewFound 1 issue:
gpui-kit/crates/component/src/input/control.rs Lines 146 to 151 in 4877110 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
input.rs keeps the InputControl extraction and takes on main's paste handler filter and touch-selection overlays after prepare(), which now owns the native menu and registry wiring those lines used to sit next to.
Adapt the features added on main after the InputGroup branch diverged. Share paste interception and touch overlays through InputControl, and expose on_paste on grouped inputs. Cover editability, clipboard payloads, and touch menus with focused interaction tests and update both documentation locales.
Contributor
Author
|
@huacnlee Addressed in 3791c0d after merging Paste handling and touch-selection overlays now use the shared |
The group used to place a private `InputControl` in its frame and mirror a subset of the input's builders on `InputGroupInput` / `InputGroupTextarea`, and a subset of the button's on `InputGroupButton` behind `with_button`. Anything the real controls gained had to be mirrored by hand — the paste hook and the touch edit menu already were not. `InputGroupInput` and `InputGroupTextarea` are now `Input` and `Textarea` under the group's names; the group renders the control without its frame and draws the border, background and ring itself, so every capability of the input reaches a group as it lands. `InputControl` and the style hooks on Icon, Spinner and Button go away with it, as does the shell's Style argument mechanism they needed. `InputGroupButton` sizes through `Sizable` like every other control: `xsmall` (default) and `small` are the compact sizes, and a button with only an icon is square at either. `InputGroupButtonSize`, `with_button`, `label_style` and `icon_style` are gone, as are the group's `focused_style`, `invalid_style` and `disabled_style`: state appearance comes from the theme, and the focus ring keeps the theme's ring color. Insets follow the input: block addons share `input_px(size)` so a leading icon or a trailing button lines up with the text, and inline addons keep a compact button the same clearance from the frame that it has from the top and bottom. The color transitions read `motion_tokens()`. The paste and long-press tests from the branch stay and pass unchanged in intent. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Superseded: the group renders Input itself now, so both come with it. The tests from that commit are kept in the previous commit.
`InputGroup` frames an `Input`, so it is reached the same way:
`gpui_component::input::{InputGroup, InputGroupAddon, …}`. The source
moves to `input/group.rs`, which also lets its tests reach the private
`state` module without widening it. The shell inventory lists the group
and its parts under `input`.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
huacnlee
enabled auto-merge (squash)
September 17, 2026 06:29
Member
|
Thank you. |
5 of 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 caller keeps the retained
InputState/TextareaState; the group owns no editing state. The control placed in the frame is the ordinary styledInput(orTextarea, which renders one), drawn without its own border, background and focus ring — the group draws those around the whole frame. SoInputGroupInputandInputGroupTextareaareInputandTextareaunder the group's names, and every builder those controls have (aria_label,content_type,on_paste,cleanable,mask_toggle,Styled) works inside a group without being mirrored. There are nogpui-basechanges, andInputitself is untouched beyond two crate-private accessors.The public parts follow shadcn/ui and live in
gpui_component::inputnext to the controls they frame:InputGroup,InputGroupInput,InputGroupTextarea,InputGroupAddon,InputGroupButton, andInputGroupText. Rust uses a typed.input(...)slot for one control and ordered.addon(...)/.child(...)composition:InputGroupButtonwraps aButtonwith compact presentation and sizes throughSizable:xsmall(default) andsmallare the compact sizes, and a button with only an icon is square at either. Focus and invalid appearance come from the theme — the focus ring keeps the theme's ring color and the invalid ring the danger color — and the border and background colors transition withmotion_tokens(). Block addons share the control's horizontal inset so a leading icon or a trailing button lines up with the text; an inline addon keeps a compact button the same clearance from the frame that it has from the top and bottom. 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. 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.
Textareagainsaccessibility_id. The following is an optional change when a simple prefix grows into a shared-frame composition:How to Test
Validated on macOS on top of the latest
main:The
input_grouptests cover the builder, appearance precedence, focus routing, embedded button actions, disabled/read-only behavior, textarea growth and scrolling between block addons, popup composition, the paste hook, and the long-press edit menu — the last two exercising capabilities the group inherits fromInputrather than implements. The shell host tests cover state callbacks, addon actions and the rejected TypeScript contracts.In the native Story, check the phone and search-scope triggers (
+1 ⌄,Documentation ⌄) sit clear of the frame, thescript.jsand comment toolbars line up with the editor text, and a focused group shows the theme's soft ring.The original implementation was developed with Codex assistance; the rework onto
InputandSizablewas written with Claude Code and reviewed by hand.