POSLayout
Responsive split or tabbed layout for the main POS browse-and-cart view
Import
import { POSLayout } from '@tallyui/components';Usage
<POSLayout
headerSlot={<Header />}
browseSlot={<ProductGrid />}
cartSlot={<CartPanel />}
/>On wide screens (at or above the breakpoint), renders a side-by-side split with the browse area taking 3/5 and the cart taking 2/5. On narrow screens, shows a tabbed interface that toggles between Browse and Cart views. The layout mode can be forced via the layout prop or left to respond automatically.
On a phone, tabBar="bottom" puts WCPOS v2's Products / Cart tab bar at the foot of the screen. Both panes stay mounted, so the catalogue's scan handling and the cart's state survive a tab switch:
<POSLayout
layout="stacked"
tabBar="bottom"
cartCount={itemCount}
browseSlot={<Catalogue {...catalogueProps} />}
cartSlot={<Cart sale={sale} />}
/>At tender, renderCheckout is WCPOS v2's checkout column: its result takes the products column's place and the catalogue unmounts. In the split layout the cart stays beside it, so the cart can draw the tender ledger; in the stacked layout it is the whole body, with no tabs, so the pane draws its own ledger:
<POSLayout
browseSlot={<Catalogue {...catalogueProps} />}
cartSlot={<Cart sale={sale} showTotal={false} tenderLedger={atTender ? {} : undefined} />}
renderCheckout={atTender ? (layout) => <Tender sale={sale} ledger={layout === 'stacked'} /> : undefined}
/>In the split layout the column fades in over 200 ms (v2's crossfade) each time checkout opens or closes, or its columnKey changes; with reduced motion it swaps at once. The stacked layout does not fade.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
browseSlot | ReactNode | required | Product browsing content |
cartSlot | ReactNode | required | Shopping cart content |
headerSlot | ReactNode | --- | Optional top header bar |
layout | 'split' | 'stacked' | auto | Force a layout mode instead of using the breakpoint |
breakpoint | number | 768 | Width threshold for switching between split and stacked |
className | string | --- | Override container styles |
tabBar | 'top' | 'bottom' | 'top' | Where the stacked layout's tabs sit; 'bottom' is WCPOS v2's phone tab bar (Products / Cart with icons), with both panes kept mounted |
cartCount | number | --- | The cart's item count, shown over the Cart tab's icon in the bottom bar; hidden at 0 |
renderCheckout | (layout: 'split' | 'stacked') => ReactNode | --- | WCPOS v2's checkout column, called with the layout in force. When given, it replaces the browse column in split and the whole body (tabs included) in stacked |
columnKey | string | --- | What the checkout column shows (e.g. receipt:<order id>); a new key fades the split column in as opening checkout does |
Slots
| Slot | Purpose |
|---|---|
browseSlot | Main product browsing area (left side in split, first tab in stacked); not rendered while renderCheckout is set |
cartSlot | Cart panel (right side in split, second tab in stacked); in stacked, not rendered while renderCheckout is set |
headerSlot | Top bar rendered above the layout with a bottom border |