Tally UI

CustomersList

CustomersList draws the Customers screen's search field and customer rows from props, as in WCPOS v2.

Import

import { CustomersList } from '@tallyui/components';

Usage

const [query, setQuery] = useState('');

<CustomersList customers={customers} query={query} onQueryChange={setQuery} loading={loading}
  onOpen={(customer) => router.push(`/customers/${customer.id}`)} onEndReached={loadNextPage} />

The app owns the search call, the paging, the route and opening the editor; the list only draws what it is given.

Props

PropTypeDefaultDescription
customersCustomer[]requiredThe rows, in order
query / onQueryChangestring / (query: string) => voidrequiredThe search field's text, and every edit of it ('' from Clear search)
onOpen(customer: Customer) => void---Pressing a row; absent, rows are not pressable and show no chevron
onEndReached() => void---The list scrolled within a tenth of its visible height of the end
loadingbooleanfalseA loading row under the rows; hides the empty states
errorstring---A sentence shown as an alert above the rows
actionsReactNode---Before the search field, such as an Add button
classNamestring---The outer view's classes
testIDstring'customers-list'Prefix for every testID; rows are <testID>-row-<id>

On this page