Skip to content
Get started
Menu
Get started

Search field

Pick provinces or banks from a long list. On a phone (window shorter side under 600 dp, in either orientation, D92) the field is a trigger that opens a full-height search sheet; on a tablet it is an inline field with a floating list.

Province and bank search triggers, including selected banks, validation and remote search examples.Province and bank search triggers, including selected banks, validation and remote search examples.
Search field
Province search sheet with the query jawa and matching province options.Province search sheet with the query jawa and matching province options.
Search field sheet
Province search sheet with the query jawa and matching province options at 200 percent text, in Indonesian.
200% text, Indonesian
Province and bank search triggers, including selected banks, validation and remote search examples at 200 percent text.
200% text
Province and bank search triggers, including selected banks, validation and remote search examples at 200 percent text, in Indonesian.
200% text, Indonesian
import 'package:flutter/material.dart';
import 'package:rakit_ui/rakit_ui.dart';
void main() => runApp(
const MaterialApp(
localizationsDelegates: [PaymentLocalizations.delegate],
home: ProvincePicker(),
),
);
class ProvincePicker extends StatefulWidget {
const ProvincePicker({super.key});
@override
State<ProvincePicker> createState() => _ProvincePickerState();
}
class _ProvincePickerState extends State<ProvincePicker> {
String? _selected;
@override
Widget build(BuildContext context) => Scaffold(
appBar: AppBar(title: const Text('Choose a province')),
body: Padding(
padding: const EdgeInsets.all(16),
child: PaymentSearchField<String>(
label: 'Province',
options: const [
PaymentSearchOption(value: 'barat', label: 'Jawa Barat'),
PaymentSearchOption(value: 'timur', label: 'Jawa Timur'),
],
selected: _selected,
onSelected: (value) => setState(() => _selected = value),
),
),
);
}

Use the combobox for selecting values; PaymentTextField.search filters a host list. Local filtering folds common Latin diacritics. onQueryChanged hands searching to your code and accepts replacement options; new options, loading and errorText reach an open sheet. Arrow keys navigate, Enter selects, Escape closes. Counts announce through a live region. Multiple selections render removable chips under the field.

Phones. Tapping the field, or Enter or Space on it, opens a full-height sheet: the label and close on top, a focused search field, then 48 dp result rows above the keyboard. A single choice closes the sheet. Multiple selection keeps a draft, with its chips and a full-width Done in the footer; close discards the draft, as PaymentSelect.multiple does. Focus returns to the field. Focusing the field from code (for example the form’s first error) never opens the sheet.

Wide screens. The field stays inline and the list floats under it in an overlay with the surface fill, the control edge and elevation, so the page doesn’t move. Any edit clears a single selection; clearing the text clears multiple selections.

Variants: single, multiple.

Situation Variant / composition Payment example
Province from 38 host options single Use multiple only for a set of values; preserve host option IDs and focus first error.

Use TextField.search to filter history without selecting an option.

Empty, selected, disabled and error states use semantic tokens. Search additionally supports loading and no matches.

Host search errors. An errorText shows the host’s explanation above the open phone sheet’s results in the danger tone, announced through a live region. Options remain selectable by tap and keyboard, including when the error is local validation. When there are no visible options, the error suppresses the no-matches message. With onQueryChanged supplied, Retry (Coba lagi in Indonesian) re-sends the sheet’s current query through that callback. The host clears errorText when starting another lookup and updates loading and options as usual. Without a query callback, the error is still readable and there is no Retry action. Pass only safe, user-facing error text; network requests and recovery stay in the host.

The error in the open sheet and its Retry (D113) were added in rakit_ui 0.2.0. In 0.1.0, errorText shows on the field only.

Layout. Result rows are at least 48 dp with text on a 16 dp inset: the field’s text edge in the floating list, the sheet gutter in the phone sheet. The loading and no-matches rows keep a 12 dp gap between the spinner or icon and the text.

Do: Use multiple only for a set of values; preserve host option IDs and focus first error.

Don’t: Submit the typed province label without choosing a host value.

Use short labels and compact localized values.

Targets are at least 48 dp. Pickers restore focus; result counts announce without platform calls. Keyboard navigation preserves Tab traversal.

Pass an optional focusNode to focus the search after form validation. The host retains ownership of that node.

Example kyc onboarding screen with synthetic dataExample kyc onboarding screen with synthetic data
Example: kyc onboarding

The search box follows the field-family PaymentFieldTheme. The results list and sheet keep their own styling. See Text field customization.

PaymentSearchField

class PaymentSearchField extends StatefulWidget · lib/src/forms/search_field.dart

Locally filtered or host-searched listbox with keyboard selection (D50).

On phones (window shortest side under 600 dp, so also in landscape; D92) the field is a trigger that opens a full-height search sheet: the search field on top, 48 dp result rows under it and, for multiple selection, the chosen chips and a full-width Done in the footer. On tablets it is an inline field with an anchored, elevated list that floats over the page instead of pushing it down.

ParameterTypeDefaultDescription
label:requiredString—Visible label for the control.
options:requiredList<PaymentSearchOption<T>>—Allowed values with their visible labels.
selected:requiredT?—Current selected host value.
onSelected:requiredValueChanged<T?>?—Reports the selected value to the host.
onQueryChanged:ValueChanged<String>?—Reports search edits for host filtering.
initialQuery:String?—Initial query shown before the first edit.
loading:boolfalseShows the pending search state.
listboxSize:PaymentSizePaymentSize.mediumDensity of the search result rows.
hint:String?—Example input shown while empty.
description:String?—Supporting explanation below the heading.
errorText:String?—Safe error message displayed beside the control.
enabled:booltrueWhether the customer can edit the search.
focusNode:FocusNode?—Optional host focus node, for example to focus the first error.

PaymentSearchField.multiple(…) — Multiple values rendered as removable chips.

ParameterTypeDefaultDescription
key:Key?——
label:requiredString——
options:requiredList<PaymentSearchOption<T>>——
selected:requiredSet<T>——
onSelectionChanged:requiredValueChanged<Set<T>>——
onQueryChanged:ValueChanged<String>?——
initialQuery:String?——
loading:boolfalse—
listboxSize:PaymentSizePaymentSize.medium—
hint:String?——
description:String?——
errorText:String?——
enabled:booltrue—
focusNode:FocusNode?——

PaymentSearchOption

class PaymentSearchOption · lib/src/forms/search_field.dart

One host value and its visible search label.

ParameterTypeDefaultDescription
value:requiredT—Stable host value returned when this option is chosen.
label:requiredString—Visible label for the control.