Skip to main content

Module input

Module input 

Source
Expand description

Form inputs.

Two flavors, matching how each control naturally behaves in gpui:

  • Controlled (Checkbox, Switch, Radio) are RenderOnce builders. The parent view owns the value and passes a change handler — wire it with cx.listener(...).
  • Stateful (TextInput, Select) are gpui entities (Render + EventEmitter) that own their buffer/open-state. Create with cx.new(|cx| TextInput::new(cx)) and subscribe for changes.

Structs§

Checkbox
A controlled checkbox. The Mantine Checkbox. Pass checked and a change handler (via cx.listener); the parent view owns the value. Or hand it a Binding via Checkbox::bind and skip the handler.
CheckboxGroup
A vertical group of checkboxes sharing one selection set.
ColorInput
A color field with a palette dropdown. Create with cx.new(|cx| ColorInput::new(cx)).
ColorInputEvent
Emitted when the color changes (typed, picked, or bound). Carries the color.
Combobox
A searchable picker. Create with cx.new(|cx| Combobox::new(cx).data([..])).
ComboboxEvent
Emitted when an option is chosen/toggled. Carries the option index.
Field
Label / description / error wrapper around a single control.
NumberInput
A numeric input. Create with cx.new(|cx| NumberInput::new(cx)).
NumberInputEvent
Emitted when the numeric value changes. Carries the parsed value.
PasswordInput
A password field with an eye toggle. Create with cx.new(|cx| PasswordInput::new(cx)).
PinInput
A one-time-code field. Create with cx.new(|cx| PinInput::new(cx)).
Radio
A controlled radio button. The Mantine Radio. Grouping/exclusivity is the parent view’s responsibility — give each a checked and a change handler.
RadioGroup
A vertical group of radios with a single selected value.
RangeSlider
A two-thumb range slider. Create with cx.new(|cx| RangeSlider::new(cx)).
RangeSliderEvent
Emitted when either end of the range changes. Carries (low, high).
Rating
A star rating. The Mantine Rating. Controlled: pass value and an on_change, or two-way bind with Rating::bind.
SegmentedControl
A segmented control. Create with cx.new(|cx| SegmentedControl::new(cx).data(["Day", "Week", "Month"])).
SegmentedControlEvent
Emitted when the selected segment changes. Carries the option index.
Select
A dropdown picker. Create with cx.new(|cx| Select::new(cx).data([...])).
SelectEvent
Emitted when the user picks an option. Carries the option index.
Slider
A horizontal slider. Create with cx.new(|cx| Slider::new(cx)).
SliderEvent
Emitted when the slider value changes.
Switch
A controlled switch. The Mantine Switch.
TagsInput
A tag list editor. Create with cx.new(|cx| TagsInput::new(cx)).
TagsInputEvent
Emitted whenever the tag list changes. Carries the full list.
TextArea
A multiline text field. Create with cx.new(|cx| TextArea::new(cx)).
TextAreaEvent
Emitted as the user edits the field. Carries the full new value.
TextEdit
An editable line of text with a cursor.
TextInput
A single-line text field. Create with cx.new(|cx| TextInput::new(cx)).

Enums§

KeyOutcome
What a keystroke did to a single-line field, so the host can react.
PasswordInputEvent
Emitted as the user edits or submits the field.
PinInputEvent
Emitted as the user edits the code.
TextInputEvent
Emitted as the user edits or submits the field.

Functions§

apply_key
Apply ks to edit, returning what the host should do. platform is Cmd on macOS; alt is Option.