# Special orders

A React block (a whole screen) in [Beamline](https://beamline.io/)'s [Shop](https://beamline.io/components/apps/shop) app. Live demo: https://beamline.io/components/special-orders

Customers' special orders as demand to buy for, per outlet: To order apart from Ordered; each product's demand, what is reserved, incoming and on order, and what to order said as that sum; a row opens on how it adds up and the customers waiting behind it. When the figures were worked out is said, stale figures say what they miss and can be worked out again, and a figure that didn't load leaves the suggestion not known rather than a number.

## Use it for

- A shop buying for customers who ordered what wasn't on the shelf: a bike shop, a bookshop, a pharmacy's orders, a furniture showroom.
- Anywhere a suggested quantity must show its sum and its sources before anyone buys.

## Not for

- Receiving deliveries against an order ([purchase-orders](https://beamline.io/components/purchase-orders)).
- Forecasting stock over weeks ([stock-horizon](https://beamline.io/components/stock-horizon)).
- One item's on-hand count ([stock-adjust](https://beamline.io/components/stock-adjust)).

## Anatomy

- header: the product's mark, the title, the outlet (select)
- toolbar: To order and Ordered (segmented, with their counts); when the figures were worked out, stale said with Work it out again
- table: product and variant (a row's chevron opens it), customers want with a bar (covered quiet, still to order outlined in the warning tone), reserved, incoming, on order (folded in a narrow room), what to order (covered, or Not known)
- opened row: the sum in words (11 wanted − 8 reserved − 1 incoming − 0 on order = 2 to order), or which figures didn't load; the waiting customers with their quantities, sales and days

## States

- no demand
- uncovered demand
- partially covered
- fully on order (in Ordered)
- stale calculation, worked out again, failed to work out again
- missing source data: the suggestion not known
- loading
- phone: the breakdown folds into the opened row
- right to left: the chevron and columns mirror
- reduced motion: the chevron turns at once

## Keyboard

- Tab through the outlet, the view, Work it out again and each row's chevron; Enter or Space opens a row

## Motion

A row's chevron turns as it opens. Nothing runs at rest.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `lines` | `DemandLine[]` | — |  |
| `defaultLines` | `DemandLine[]` | — |  |
| `onLinesChange` | `((lines: DemandLine[]) => void)` | — |  |
| `outlets` (required) | `{ id: string; name: string; }[]` | — |  |
| `outlet` | `string` | — |  |
| `defaultOutlet` | `string` | — |  |
| `onOutletChange` | `((id: string) => void)` | — |  |
| `defaultOpenLine` | `string \| null` | — | A product's row opened at the start, showing how it adds up. |
| `calculatedAt` (required) | `string` | — | When the figures were worked out (ISO date-time). |
| `staleAfter` | `number` | — | Older than this many minutes, the figures are said to be stale. Default 60. |
| `now` | `number` | — | The clock. Default the device's. |
| `onRecalculate` | `(() => Promise<{ lines: DemandLine[]; calculatedAt: string; }>)` | — | Work the figures out again; resolve with the new lines and when. Reject to keep the old ones (said). |
| `timeZone` | `string` | — | Time zone the times are said in. |
| `loading` | `boolean` | — |  |
| `product` | `string` | — | Your product's name, shown as its mark. |
| `className` | `string` | — | Classes on the documented visual root; no override by default. |
| `ref` | `Ref<HTMLDivElement>` | — | Receives the documented native target or imperative handle; omitted by default. |
| `purchaseOrders` | `AssignableOrder[]` | — | Purchase orders the chosen products can join (with onAssign, rows To order gain a checkbox). |
| `onAssign` | `((assignment: Assignment) => Promise<unknown>)` | — | Add the chosen products to an order. Reject when the order changed meanwhile (nothing added, said). |
| `currency` | `string` | — | Currency of costs entered when adding to an order. Default "USD". |

## Built from

- [Avatar](https://beamline.io/components/avatar.md)
- [Bottom sheet](https://beamline.io/components/bottom-sheet.md)
- [Button](https://beamline.io/components/button.md)
- [Checkbox](https://beamline.io/components/checkbox.md)
- [Combobox](https://beamline.io/components/combobox.md)
- [Copy button](https://beamline.io/components/copy-button.md)
- [Description list](https://beamline.io/components/description-list.md)
- [Empty state](https://beamline.io/components/empty-state.md)
- [Label](https://beamline.io/components/label.md)
- [Number field](https://beamline.io/components/number-field.md)
- [Radio cards](https://beamline.io/components/radio-cards.md)
- [Segmented control](https://beamline.io/components/segmented-control.md)
- [Select](https://beamline.io/components/select.md)
- [Skeleton](https://beamline.io/components/skeleton.md)
- [Spinner](https://beamline.io/components/spinner.md)
- [Switch](https://beamline.io/components/switch.md)
- [Text morph](https://beamline.io/components/text-morph.md)
- [Textarea](https://beamline.io/components/textarea.md)
- [Tooltip](https://beamline.io/components/tooltip.md)

## Dependencies

`lucide-react`

## Import

```tsx
import { SpecialOrders } from "@beamline/special-orders";
```

## Get it

Special orders is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. [Get Beamline](https://beamline.io/checkout?pack=complete) · [Connect your agent](https://beamline.io/connect)

## More in Shop

- [Product editor](https://beamline.io/components/product-editor): A product being made in a shop's back office, every value read as text at rest. The variant grid, grouped by the first option, lists each combination…
- [Category manager](https://beamline.io/components/category-manager): A shop's product categories, nested and ranked. Each category moves up, down or into another from its menu, and every move gets its own receipt (saving…
- [Inventory item](https://beamline.io/components/inventory-item): One stock item in a shop's back office, apart from the variants that sell it (how many each uses per unit). Stock per location as stocked, reserved and…
- [Plan comparison](https://beamline.io/components/plan-comparison): Plans side by side against every feature: prices that roll between monthly and yearly, the current and recommended plan marked, a header that stays in…
- [Step form](https://beamline.io/components/step-form): The finished frame for any multi-step form you compose — onboarding, intake brief, questionnaire, booking, application: a wide card with progress, the…
- [Orders admin](https://beamline.io/components/orders-admin): A shop's order desk: today's orders and revenue, quick filters for what needs doing (to fulfil, unpaid, returns), a virtualised orders grid, and the…
- [Order detail](https://beamline.io/components/order-detail): One shop order with payment and fulfilment as two separate lanes. The header says where each stands (paid, partly paid, awaiting, refunded; not…
- [Order board](https://beamline.io/components/order-board): A shop's orders as cards in its columns, on the shared kanban with drag and keyboard moves. Each card: number, estimate or work order, customer, vehicle…
- [Order composer](https://beamline.io/components/order-composer): An order made inside a support ticket: products found by name, each variant with its stock drawn and said (in stock, none, oversold, not known) and the…
- [Draft orders](https://beamline.io/components/draft-orders): A draft order made for a customer in a shop's back office that reads like the order it will become. The lines lead: each with its variant and SKU or…
- [Order changes](https://beamline.io/components/order-changes): What happens to a shop order after it's placed. Edit: the order as it stands beside the requested version, each line marked new, changed (old → new…
- [Order history and fills](https://beamline.io/components/order-history): Every order the account placed and every fill it got, for a period: totals for volume, fees, fill rate and maker share; orders with their status and how…
- [Order ledger](https://beamline.io/components/order-ledger): Purchase orders as money. Each order's spend is drawn against its approved total (paid, billed, pending, what is left, and any overrun past the end…
- [Ticket orders](https://beamline.io/components/ticket-orders): A customer's orders inside a support ticket, each action's effect said before it's done: orders and drafts kept apart, a paid draft shown once as its…
- [Record search](https://beamline.io/components/record-search): One search across connected records (customers, vehicles, orders) by name, phone, plate, VIN or order number. What the words look like is said (info)…
- [Return queue](https://beamline.io/components/return-queue): A queue of return cases. Search by return, order or customer, exactly (the default) or loosely; status tabs with counts, Requires attention first; a date…
- [Return case](https://beamline.io/components/return-case): One return as one place where every act is its own. The return, its order (linked out) and the customer on three cards; the stage said on its tone. Items…
- [Return request](https://beamline.io/components/return-request): Staff start a return from an order, and edit the reasons customers pick. New return: the order's lines as a checklist, each with its variant, price and…
- [Purchase orders](https://beamline.io/components/purchase-orders): A salon's purchase orders, received: the orders down the side, the chosen one beside them. Each line still due reads as a strip of received, this…
- [Print quote](https://beamline.io/components/print-quote): A print shop's quoting in three places. Quote: a group of garments that share one imprint and one quantity break, the group's pieces counted together and…
- [Service estimate](https://beamline.io/components/service-estimate): An estimate for one vehicle. Services added from the catalogue (one not listed for this vehicle said on warning, fit unknown said); each with its lines…
- [Job card](https://beamline.io/components/job-card): A technician's repair order, phone-first. The vehicle, the customer and when it's due in words (due at, due in, overdue by how long); an offline copy…
- [Parts tracker](https://beamline.io/components/parts-tracker): Parts across a shop's work orders: each with its number, the order and vehicle, supplier, quantity and cost (not known said), and where it is: ordered…
- [Visit board](https://beamline.io/components/visit-board): The staff board for a walk-in queue: visits move from waiting through called and serving to done today. Arrival (here or on the way), the place in the…

Part of [Beamline UI: polished, editable React components and complete screens for custom applications](https://beamline.io/). [Build your own style from any look; tokens, fonts, radii, motion; not only colours](https://beamline.io/docs/customize).
