FossCombobox<T> class Inputs

FossCombobox, light theme FossCombobox, dark theme

See the combobox documentation ↗ or try it live in the playground ↗.

A text field with a filtered dropdown of predefined items, each carrying a check when picked.

Unlike FossAutocomplete, the value is the selected item, not the raw text: pass value and rebuild on onChanged. Picking a row writes its label into the field and closes the popup. A null onChanged (or enabled: false) disables the field.

Customize globally by passing your own FossThemeData, or per instance through the widget's style object. There are no per-instance token props: to change color, radius, or spacing, change the theme.

See also FossSelect for selection without typing.

FossCombobox<String>(
  label: 'Team',
  hintText: 'Search teams',
  value: team,
  onChanged: (v) => setState(() => team = v),
  items: const [
    FossComboboxItem(value: 'design', label: 'Design'),
    FossComboboxItem(value: 'eng', label: 'Engineering'),
  ],
);
Inheritance

Constructors

FossCombobox({required List<FossComboboxItem<T>> items, T? value, ValueChanged<T?>? onChanged, FocusNode? focusNode, FossTextFieldSize size = FossTextFieldSize.md, String? label, String? hintText, String? errorText, bool enabled = true, bool showClear = false, Widget? startAddon, bool filter(String label, String query)?, String emptyText = _defaultEmptyText, FossComboboxStyle? style, Key? key})
FossCombobox, light theme FossCombobox, dark theme
const

Properties

emptyText → String
Caption shown when the query matches no option.
final
enabled → bool
Whether the field accepts input. Disabled when false or onChanged is null.
final
errorText → String?
When non-null, marks the field invalid and recolors its border.
final
filter → bool Function(String label, String query)?
Overrides the default case-insensitive substring match.
final
focusNode → FocusNode?
Manages keyboard focus. Created and disposed internally when null.
final
hashCode → int
The hash code for this object.
no setterinherited
hintText → String?
Placeholder shown while the field is empty.
final
items → List<FossComboboxItem<T>>
The options to choose from.
final
key → Key?
Controls how one widget replaces another widget in the tree.
finalinherited
label → String?
Optional label rendered above the field.
final
onChanged → ValueChanged<T?>?
Called with the picked value when a row is chosen. A null callback disables the field.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
showClear → bool
Whether to show a trailing clear button while a value is selected.
final
size → FossTextFieldSize
The field height and type scale.
final
startAddon → Widget?
Optional leading widget, typically a search glyph. Icon-agnostic.
final
style → FossComboboxStyle?
Per-instance overrides layered on the theme-resolved style.
final
value → T?
The picked value, or null when nothing is selected.
final

Methods

build(BuildContext context) → Widget
Describes the part of the user interface represented by this widget.
override
createElement() → StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() → List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) → String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String
Returns a one-line detailed description of the object.
inherited
toStringShort() → String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited