CustomerSelect
CustomerSelect presents searchable CustomerCard items with a highlighted selection, while the parent handles filtering and selection state.
Import
import { CustomerSelect } from '@tallyui/components';Usage
<CustomerSelect
customers={filteredCustomers}
selected={selectedCustomer}
onSelect={setSelectedCustomer}
onSearch={setSearchQuery}
/>A customer picker that renders a scrollable list of CustomerCard items. When a customer is selected, their card is highlighted at the top. The parent component owns the filtering logic -- this component simply calls onSearch with the query text and renders the customers array it receives.
Requires a ConnectorProvider ancestor in the component tree.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
customers | any[] | required | Customer documents to display |
selected | any | --- | Currently selected customer |
onSelect | (customer) => void | required | Called when a customer is tapped |
traits | CustomerTraits<Doc> | from ConnectorProvider | Customer traits used to read ids, names and emails; read from the connector context when omitted |
onSearch | (query: string) => void | required | Called when search text changes |
placeholder | string | 'Search customers...' | Search input placeholder |
showSearch | boolean | true | Renders the search input; pass false when the parent renders its own, as CustomerPicker does |
showAvatar | boolean | false | Draws an initials avatar before each row and the selected summary, as v2's cart dropdown |
avatarTone | 'muted' | 'primary' | 'primary' | The avatar's tone; 'primary' is v2's look (light initials on a solid primary circle) |
className | string | --- | Override container styles |