Select
A trigger that opens a list of options and displays the chosen one.
This demo runs the real GPUI component on WebGPU, which this browser does not expose.
Try Chrome or Edge 113+, or Safari 26+. In Firefox, enable dom.webgpu.enabled.
You can also run it natively: cargo run -p showcase select
The demo failed to start in this browser.
You can run it natively instead: cargo run -p showcase select
Live examples are not supported on most mobile browsers yet — open this page on a desktop or tablet to run the demo.
Recent phones with WebGPU may manage it (downloads ~18 MB):
#Anatomy
Import the component's parts and compose them under its root:
use base_gpui::select::{
SelectArrow,
SelectBackdrop,
SelectGroup,
SelectGroupLabel,
SelectIcon,
SelectItem,
SelectItemIndicator,
SelectItemText,
SelectLabel,
SelectList,
SelectPopup,
SelectPortal,
SelectPositioner,
SelectRoot,
SelectScrollDownArrow,
SelectScrollUpArrow,
SelectSeparator,
SelectTrigger,
SelectValue,
};
SelectRoot::new()
.child(
SelectLabel::new(),
)
.child(
SelectPortal::new()
.child(
SelectBackdrop::new(),
)
.child(
SelectPositioner::new()
.child(
SelectArrow::new(),
)
.child(
SelectList::new()
.child(
SelectGroup::new()
.child(
SelectGroupLabel::new(),
)
.child(
SelectItem::new()
.child(
SelectItemIndicator::new(),
)
.child(
SelectItemText::new(),
),
)
.child(
SelectSeparator::new(),
),
),
)
.child(
SelectPopup::new()
.child(
SelectScrollDownArrow::new(),
)
.child(
SelectScrollUpArrow::new(),
),
),
),
)
.child(
SelectTrigger::new()
.child(
SelectIcon::new(),
)
.child(
SelectValue::new(),
),
);
The anatomy is a structural overview. Parts with mutually exclusive modes may need separate instances; each part's section below documents its configuration.
#SelectRoot
Coordinates the component's state and supplies context to its child parts.
use base_gpui::select::SelectRoot;
SelectRoot::new()
.id("example-id")
.name("name")
.form(/* form: impl Into<SharedString> */)
.default_value(None)
.value(None)
.on_value_change(|/* callback arguments */| { /* handle change */ })
.default_open(true)
.open(true)
.on_open_change(|/* callback arguments */| { /* handle change */ })
.multiple(true)
.default_values(/* default_values: Vec<T> */)
.values(/* values: Vec<T> */)
.on_values_change(|/* callback arguments */| { /* handle change */ })
.disabled(true)
.read_only(true)
.required(true)
.highlight_item_on_hover(true)
.modal(true)
.label_resolver(|/* callback arguments */| { /* handle change */ })
.value_serializer(|/* callback arguments */| { /* handle change */ })
.item_to_string_value(|/* callback arguments */| { /* handle change */ })
.value_comparator(|/* callback arguments */| { /* handle change */ })
.multiple_value_formatter(|/* callback arguments */| { /* handle change */ })
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectRoot with its default configuration. |
.child | pub fn child(mut self, child: impl Into<SelectChild<T>>) -> Self
Adds one typed child to this part. |
.children | pub fn children(mut self, children: impl IntoIterator<Item = impl Into<SelectChild<T>>>,) -> Self
Adds multiple typed children in iteration order. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.id | pub fn id(mut self, id: impl Into<ElementId>) -> Self
Sets the stable GPUI element identity. Use a unique value when multiple instances can appear in the same view. |
.name | pub fn name(mut self, name: impl Into<SharedString>) -> Self
Sets the form field name used when serializing or submitting the value. |
.form | pub fn form(mut self, form: impl Into<SharedString>) -> Self
Sets the form configuration for this part. |
.default_value | pub fn default_value(mut self, default_value: Option<T>) -> Self
Sets the initial value for uncontrolled state. Later user changes are retained by the component. |
.value | pub fn value(mut self, value: Option<T>) -> Self
Sets the current controlled value or the value represented by this part, depending on the part's role. |
.on_value_change | pub fn on_value_change(mut self, on_value_change: impl Fn(Option<&T>, &mut SelectValueChangeDetails, &mut Window, &mut App) + 'static,) -> Self
Registers a callback invoked when value change occurs. |
.default_open | pub fn default_open(mut self, default_open: bool) -> Self
Sets the initial open state for an uncontrolled component. |
.open | pub fn open(mut self, open: bool) -> Self
Controls whether the component is open. |
.on_open_change | pub fn on_open_change(mut self, on_open_change: impl Fn(bool, &mut SelectOpenChangeDetails, &mut Window, &mut App) + 'static,) -> Self
Registers a callback invoked when open change occurs. |
.multiple | pub fn multiple(mut self, multiple: bool) -> Self
Controls whether more than one value may be selected at the same time. |
.default_values | pub fn default_values(mut self, default_values: Vec<T>) -> Self
Sets the initial values for uncontrolled state. |
.values | pub fn values(mut self, values: Vec<T>) -> Self
Sets the values configuration for this part. |
.on_values_change | pub fn on_values_change(mut self, on_values_change: impl Fn(&[T], &mut SelectValueChangeDetails, &mut Window, &mut App) + 'static,) -> Self
Registers a callback invoked when values change occurs. |
.disabled | pub fn disabled(mut self, disabled: bool) -> Self
When true, prevents user interaction with this part. |
.read_only | pub fn read_only(mut self, read_only: bool) -> Self
When true, allows presentation and focus behavior without permitting value changes. |
.required | pub fn required(mut self, required: bool) -> Self
Marks the control as required for validation and accessibility state. |
.highlight_item_on_hover | pub fn highlight_item_on_hover(mut self, highlight_item_on_hover: bool) -> Self
Controls whether highlight item on hover behavior is enabled. |
.modal | pub fn modal(mut self, modal: bool) -> Self
Controls whether the overlay behaves modally and blocks interaction outside it. |
.label_resolver | pub fn label_resolver(mut self, resolver: impl Fn(&T) -> SharedString + 'static) -> Self
Sets the label resolver configuration for this part. |
.value_serializer | pub fn value_serializer(mut self, serializer: impl Fn(&T) -> SharedString + 'static) -> Self
Sets the value serializer configuration for this part. |
.item_to_string_value | pub fn item_to_string_value(self, serializer: impl Fn(&T) -> SharedString + 'static) -> Self
Sets the item to string value configuration for this part. |
.value_comparator | pub fn value_comparator(mut self, comparator: impl Fn(&T, &T) -> bool + 'static) -> Self
Sets the value comparator configuration for this part. |
.multiple_value_formatter | pub fn multiple_value_formatter(mut self, formatter: impl Fn(&[SharedString], &[T]) -> SharedString + 'static,) -> Self
Sets the multiple value formatter configuration for this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectRootStyleState<T>, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectRoot also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectTrigger
Interactive control that opens, closes, or activates the component.
use base_gpui::select::SelectTrigger;
SelectTrigger::new()
.id("example-id")
.aria_label("label")
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectTrigger with its default configuration. |
.child | pub fn child(mut self, child: impl Into<SelectTriggerChild<T>>) -> Self
Adds one typed child to this part. |
.children | pub fn children(mut self, children: impl IntoIterator<Item = impl Into<SelectTriggerChild<T>>>,) -> Self
Adds multiple typed children in iteration order. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.id | pub fn id(mut self, id: impl Into<ElementId>) -> Self
Sets the stable GPUI element identity. Use a unique value when multiple instances can appear in the same view. |
.aria_label | pub fn aria_label(mut self, label: impl Into<SharedString>) -> Self
Sets the accessible name announced for the trigger. Base UI relies on |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectTriggerStyleState<T>, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectTrigger also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectPortal
Hosts overlay content outside the normal child layout.
use base_gpui::select::SelectPortal;
SelectPortal::new()
.force_mounted(true)
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectPortal with its default configuration. |
.child | pub fn child(mut self, child: impl Into<SelectPortalChild<T>>) -> Self
Adds one typed child to this part. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.force_mounted | pub fn force_mounted(mut self, force_mounted: bool) -> Self
Controls whether force mounted behavior is enabled. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectPortalStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectPortal also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectPositioner
Measures the anchor and positions floating content.
use base_gpui::select::SelectPositioner;
SelectPositioner::new()
.side("example-id")
.align(/* align: SelectAlign */)
.side_offset("example-id")
.align_offset(/* align_offset: Pixels */)
.collision_padding(/* collision_padding: Pixels */)
.align_item_with_trigger(true)
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectPositioner with its default configuration. |
.child | pub fn child(mut self, child: impl Into<SelectPositionerChild<T>>) -> Self
Adds one typed child to this part. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.side | pub fn side(mut self, side: SelectSide) -> Self
Sets the preferred side of the anchor on which floating content appears. |
.align | pub fn align(mut self, align: SelectAlign) -> Self
Sets floating content alignment along the selected side. |
.side_offset | pub fn side_offset(mut self, side_offset: Pixels) -> Self
Sets the distance between floating content and its anchor. |
.align_offset | pub fn align_offset(mut self, align_offset: Pixels) -> Self
Offsets floating content along its alignment axis. |
.collision_padding | pub fn collision_padding(mut self, collision_padding: Pixels) -> Self
Sets the minimum space retained between floating content and viewport edges. |
.align_item_with_trigger | pub fn align_item_with_trigger(mut self, align_item_with_trigger: bool) -> Self
Sets the align item with trigger configuration for this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectPositionerStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectPositioner also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectPopup
Contains the floating interactive content.
use base_gpui::select::SelectPopup;
SelectPopup::new()
.side("example-id")
.align(/* align: SelectAlign */)
.force_mounted(true)
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectPopup with its default configuration. |
.child | pub fn child(mut self, child: impl Into<SelectPopupChild<T>>) -> Self
Adds one typed child to this part. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.side | pub fn side(mut self, side: SelectSide) -> Self
Sets the preferred side of the anchor on which floating content appears. |
.align | pub fn align(mut self, align: SelectAlign) -> Self
Sets floating content alignment along the selected side. |
.force_mounted | pub fn force_mounted(mut self, force_mounted: bool) -> Self
Controls whether force mounted behavior is enabled. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectPopupStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectPopup also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectArrow
Optional arrow that visually points toward the overlay anchor.
use base_gpui::select::SelectArrow;
SelectArrow::new()
.side("example-id")
.align(/* align: SelectAlign */)
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectArrow with its default configuration. |
.side | pub fn side(mut self, side: SelectSide) -> Self
Sets the preferred side of the anchor on which floating content appears. |
.align | pub fn align(mut self, align: SelectAlign) -> Self
Sets floating content alignment along the selected side. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectArrowStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectArrow also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectBackdrop
Covers content behind a modal overlay and handles outside interaction.
use base_gpui::select::SelectBackdrop;
SelectBackdrop::new()
.force_mounted(true)
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectBackdrop with its default configuration. |
.force_mounted | pub fn force_mounted(mut self, force_mounted: bool) -> Self
Controls whether force mounted behavior is enabled. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectBackdropStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectBackdrop also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectGroup
Groups related child parts and coordinates their shared behavior.
use base_gpui::select::SelectGroup;
SelectGroup::new()
.id("example-id")
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectGroup with its default configuration. |
.id | pub fn id(mut self, id: impl Into<ElementId>) -> Self
Sets the stable GPUI element identity. Use a unique value when multiple instances can appear in the same view. |
.child | pub fn child(mut self, child: impl Into<SelectGroupChild<T>>) -> Self
Adds one typed child to this part. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectGroupStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectGroup also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectGroupLabel
Provides a visible label and associated accessibility semantics.
use base_gpui::select::SelectGroupLabel;
SelectGroupLabel::new()
.label("label")
.text("label")
.registration_label()
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectGroupLabel with its default configuration. |
.label | pub fn label(mut self, label: impl Into<SharedString>) -> Self
Sets the label configuration for this part. |
.text | pub fn text(self, label: impl Into<SharedString>) -> Self
Sets the text configuration for this part. |
.registration_label | pub fn registration_label(&self) -> Option<SharedString>Sets the registration label configuration for this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectGroupLabelStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectGroupLabel also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectIcon
Optional visual icon for the component.
use base_gpui::select::SelectIcon;
SelectIcon::new()
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectIcon with its default configuration. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectIconStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectIcon also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectItem
Represents one interactive item in the component's collection.
use base_gpui::select::SelectItem;
SelectItem::new()
.id("example-id")
.value(/* value: T */)
.label("label")
.disabled(true)
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectItem with its default configuration. |
.child | pub fn child(mut self, child: impl Into<SelectItemChild<T>>) -> Self
Adds one typed child to this part. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.id | pub fn id(mut self, id: impl Into<ElementId>) -> Self
Sets the stable GPUI element identity. Use a unique value when multiple instances can appear in the same view. |
.value | pub fn value(mut self, value: T) -> Self
Assigns the item value that participates in selection. Values are compared with |
.label | pub fn label(mut self, label: impl Into<SharedString>) -> Self
Sets the label configuration for this part. |
.disabled | pub fn disabled(mut self, disabled: bool) -> Self
When true, prevents user interaction with this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectItemStyleState<T>, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectItem also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectItemIndicator
Visual indicator for an item's selected or checked state.
use base_gpui::select::SelectItemIndicator;
SelectItemIndicator::new()
.keep_mounted(true)
.with_item_state(/* state: SelectItemStyleState<T> */)
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectItemIndicator with its default configuration. |
.keep_mounted | pub fn keep_mounted(mut self, keep_mounted: bool) -> Self
Keeps the part mounted when inactive or closed so child state can be preserved. |
.with_item_state | pub fn with_item_state(mut self, state: SelectItemStyleState<T>) -> Self
Sets the with item state configuration for this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectItemIndicatorStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectItemIndicator also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectItemText
Public renderable part of the Select Item Text component.
use base_gpui::select::SelectItemText;
SelectItemText::new()
.label("label")
.text("label")
.with_item_state(/* state: SelectItemStyleState<T> */)
.registration_label()
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectItemText with its default configuration. |
.label | pub fn label(mut self, label: impl Into<SharedString>) -> Self
Sets the label configuration for this part. |
.text | pub fn text(self, label: impl Into<SharedString>) -> Self
Sets the text configuration for this part. |
.with_item_state | pub fn with_item_state(mut self, state: SelectItemStyleState<T>) -> Self
Sets the with item state configuration for this part. |
.registration_label | pub fn registration_label(&self) -> Option<SharedString>Sets the registration label configuration for this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectItemTextStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectItemText also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectLabel
Provides a visible label and associated accessibility semantics.
use base_gpui::select::SelectLabel;
SelectLabel::new()
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectLabel with its default configuration. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn((), Div) -> Div + 'static) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectLabel also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectList
Contains and coordinates the component's collection items.
use base_gpui::select::SelectList;
SelectList::new()
.loop_focus(true)
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectList with its default configuration. |
.child | pub fn child(mut self, child: impl Into<SelectListChild<T>>) -> Self
Adds one typed child to this part. |
.child_any | pub fn child_any(mut self, child: impl IntoElement) -> Self
Adds one arbitrary renderable child to this part. |
.loop_focus | pub fn loop_focus(mut self, loop_focus: bool) -> Self
Controls whether keyboard focus wraps from the last enabled item to the first and vice versa. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectListStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectList also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectScrollDownArrow
Optional arrow that visually points toward the overlay anchor.
use base_gpui::select::SelectScrollDownArrow;
SelectScrollDownArrow::new()
.keep_mounted(true)
.side("example-id")
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectScrollDownArrow with its default configuration. |
.keep_mounted | pub fn keep_mounted(mut self, keep_mounted: bool) -> Self
Keeps the part mounted when inactive or closed so child state can be preserved. |
.side | pub fn side(mut self, side: SelectSide) -> Self
Sets the preferred side of the anchor on which floating content appears. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectScrollArrowStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectScrollDownArrow also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectScrollUpArrow
Optional arrow that visually points toward the overlay anchor.
use base_gpui::select::SelectScrollUpArrow;
SelectScrollUpArrow::new()
.keep_mounted(true)
.side("example-id")
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectScrollUpArrow with its default configuration. |
.keep_mounted | pub fn keep_mounted(mut self, keep_mounted: bool) -> Self
Keeps the part mounted when inactive or closed so child state can be preserved. |
.side | pub fn side(mut self, side: SelectSide) -> Self
Sets the preferred side of the anchor on which floating content appears. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectScrollArrowStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectScrollUpArrow also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectSeparator
Visual separator between neighboring items or groups.
use base_gpui::select::SelectSeparator;
SelectSeparator::new()
.orientation(/* orientation: SeparatorOrientation */)
.horizontal()
.vertical()
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectSeparator with its default configuration. |
.orientation | pub fn orientation(mut self, orientation: SeparatorOrientation) -> Self
Sets the component's horizontal or vertical orientation and corresponding keyboard behavior. |
.horizontal | pub fn horizontal(self) -> SelfSets the horizontal configuration for this part. |
.vertical | pub fn vertical(self) -> SelfSets the vertical configuration for this part. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SeparatorStyleState, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectSeparator also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#SelectValue
Displays or edits the component's current value.
use base_gpui::select::SelectValue;
SelectValue::new()
.placeholder("placeholder")
.style_with_state(|/* callback arguments */| { /* handle change */ });
#Builders
| Builder | Signature & description |
|---|---|
.new | pub fn new() -> SelfCreates a SelectValue with its default configuration. |
.placeholder | pub fn placeholder(mut self, placeholder: impl Into<SharedString>) -> Self
Sets the content shown when the component has no current value. |
.style_with_state | pub fn style_with_state(mut self, style: impl Fn(SelectValueStyleState<T>, Div) -> Div + 'static,) -> Self
Styles the part from its current behavioral state while preserving separation between behavior and visual design. SelectValue also supports the GPUI traits implemented in its source, such as standard styling or child composition. |
#Accessibility
Keyboard interaction and accessibility semantics are implemented by the component, independently of visual styling. Known limitations caused by missing GPUI accessibility primitives are documented in the module source and are not silently approximated.
#Stability
Base GPUI is pre-1.0. Builder names and state types may evolve as GPUI and this port mature.