Skip to main content

MultinairePickerButton

Dropdown trigger button that displays a selected value and opens a picker.

Basic Usage

import { MultinairePickerButton } from '@multinaire/multinaire-design';

<MultinairePickerButton
placeholder="Select option"
value={selectedLabel}
onPress={() => setPickerVisible(true)}
/>

Props

PropTypeDefaultDescription
placeholderstringPlaceholder text shown when the field is empty
valuestringCurrent value of the input
titlestringField label displayed above the input
requiredbooleanfalseMark the field as required. Displays a visual indicator
allowClearbooleanfalseShow a clear (×) button to reset the value
leadingIconName | ReactElementLeading icon name or a custom React element rendered at the start of the input
trailingIconName | ReactElementTrailing icon name or a custom React element rendered at the end of the input
extraReactElementExtra element rendered at the trailing end of the label row (e.g. a "Forgot password?" link)
errorTextstringError message displayed below the input
flexnumberFlex grow value
marginSpacingPropsOuter margin
onPress() => voidPress handler that opens the picker
onClear() => voidCallback invoked when the user clears the current selection

Examples

Basic Picker

<MultinairePickerButton
title="Country"
placeholder="Select a country"
value={selectedCountry?.name}
onPress={() => setCountryPickerVisible(true)}
/>

With Clear Button

<MultinairePickerButton
title="Category"
placeholder="Select category"
value={category}
allowClear
onPress={() => setCategoryPickerVisible(true)}
onClear={() => setCategory(null)}
/>

With Leading Icon

<MultinairePickerButton
leading="Calendar"
placeholder="Select date"
value={formattedDate}
onPress={() => setDatePickerVisible(true)}
/>

With Error

<MultinairePickerButton
title="Required Field"
required
placeholder="Please select"
value={value}
errorText={!value ? 'This field is required' : undefined}
onPress={openPicker}
/>

With ListPicker

<MultinairePickerButton
title="Country"
placeholder="Select country"
value={country?.name}
onPress={() => setVisible(true)}
/>

<MultinaireListPicker
type="dropdown"
visible={visible}
items={countries}
selectedItem={country}
onChange={(item) => {
setCountry(item);
setVisible(false);
}}
/>