Skip to content
Get started
Menu
Get started

Tabs

PaymentTabs switches between views of the same content: filters of a list, or “Card” and “Bank transfer” details. TransactionHistory uses it for its filters.

Card, bank transfer and wallet tabs with selected, disabled and overflowing labels.Card, bank transfer and wallet tabs with selected, disabled and overflowing labels.
Tabs
Card, bank transfer and wallet tabs with selected, disabled and overflowing labels at 200 percent text.
200% text
Transaction history in Indonesian: a search field, filter tabs with Semua selected and underlined, and a list of transactions.Transaction history in Indonesian: a search field, filter tabs with Semua selected and underlined, and a list of transactions.
The same tabs as history filters (Indonesian)
example/lib/screens/gallery_selection.dart
PaymentTabs(
fitted: true,
tabs: const [
PaymentTab(label: 'Card'),
PaymentTab(label: 'Bank transfer'),
PaymentTab(label: 'Wallet'),
],
selectedIndex: 0,
onSelected: (_) {},
);

Variants: small, medium, large; fitted or intrinsic.

The selected tab changes to the accent color and gains a 2 px underline. The weight stays the same so labels do not shift when chosen, and screen readers hear it as selected.

The row scrolls sideways instead of wrapping, so long or enlarged labels never stack into a block. The row sits on a 1 px outline hairline.

PaymentTabs holds the PaymentTabs and PaymentTabPanels the panels; selectedIndex and onSelected control selection. Sizes are small (caption, 8 dp sides), medium (label, 12 dp), and large (heading, 16 dp); every target stays at least 48 dp. Fitted divides the available width equally. Arrow keys move focus without selection and skip disabled tabs; Enter or Space selects. A disabledReason is spoken as a hint and shown in a tooltip; explain unavailability in visible content too.

Panels build on first selection and keep state. Offstage, TickerMode and ExcludeFocus hide inactive panels and pause their tickers. Do not put a requirement exclusively in a hidden panel.

Breaking migration: replace labels with tabs, wrapping each string in PaymentTab(label: …).

Fitted tabs use equal widths only when every label fits at the current text scale. Otherwise they scroll horizontally, preserving whole words.

Situation Variant / composition Payment example
Transaction status filters intrinsic Use views of the same records; disabled tabs need a reason.

Use List for navigation to separate account destinations.

The host supplies the selected tab. Disabled tabs stay visible but cannot be selected.

Layout. When the tabs do not fit, the row scrolls and fades at the edge that has more tabs. Selecting or focusing a tab scrolls the row so that tab is fully visible; only the tab row moves, never the page. Under reduced motion the row jumps instead of animating.

Do: Use views of the same records; disabled tabs need a reason.

Don’t: Use tabs as a sequence of required KYC tasks.

  • Use short nouns, one or two words each: “All”, “Pending”, “Refunds”.
  • Use sentence case and no end punctuation.
  • Use tabs for views of the same content. To move between screens use the navigation shell; to make a choice that is saved, use radios.
  • Each tab is a button at least 48 × 48 dp, marked selected or not.
  • Tabs press to 0.96 like other compact controls, and keyboard focus draws the kit’s focus ring; the row clips only at its sides so the ring stays visible.
Example history screen with synthetic dataExample history screen with synthetic data
Example: history

PaymentTabs

class PaymentTabs extends StatefulWidget · lib/src/controls/controls.dart

Controlled tabs. Arrows move focus, skipping disabled tabs; Enter or Space selects. Sizes change typography and padding, never the 48 dp target.

ParameterTypeDefaultDescription
tabs:requiredList<PaymentTab>—Tabs in reading order.
selectedIndex:requiredint—Host-owned active tab index.
onSelected:requiredValueChanged<int>—Reports manual tab activation.
size:PaymentSizePaymentSize.mediumTypography and padding size.
fitted:boolfalseDivide available width equally when every label fits; otherwise scroll.

PaymentTab

class PaymentTab · lib/src/controls/controls.dart

A tab label and optional unavailability reason.

ParameterTypeDefaultDescription
label:requiredString—Visible tab label.
disabledReason:String?—Explanation for an unavailable tab.

PaymentTabPanels

class PaymentTabPanels extends StatefulWidget · lib/src/controls/controls.dart

Lazily builds selected panels and preserves visited state. Hidden panels are offstage, excluded from focus and semantics, and have paused tickers.

ParameterTypeDefaultDescription
selectedIndex:requiredint——
children:requiredList<Widget>——

PaymentSize

enum PaymentSize · lib/src/foundation/payment_tokens.dart

Visual size only; layout box and hit area stay at least 48×48 dp. Components document their heights.

ValueDescription
smallModule headers, table or chip rows; never the main action.
mediumDefault, today's visual size.
largeOne primary action on a full-screen wide view.