Line Item
ProOne product line of a cart, checkout or order: thumbnail, name, optional variant and quantity, and price. A slot before the price takes a stepper or a remove button.
Playground
Installation
Line Item comes with WunderUI Core and Pro, in the package from your plan. See the plans.
Then import what you need:
import { LineItem, LineItemProps } from "@wunderui/react"Then use it:
import { LineItem } from "@wunderui/react"
export function Line() {
return <LineItem name="Nord standing desk" variant="Oak, 160 × 80 cm" price="$649.00" tint="indigo" />
}Expected result: You see a row with a 48 px indigo tile and a package icon on the left, the product name with the variant under it, and the price on the right. Put it in a bordered card to see its padding.
When to use
Use Line Item for
- The lines of a cart, with a quantity stepper or a remove button before the price
- The compact products of an order summary or an invoice
- A receipt or an order confirmation where each product is one row
Use something else for
- Product Card for a product to browse, with a large image, a rating and an add to cart button
- Compact Product Card for a small suggestion beside the cart with a quick add button
- Table for an order with many columns, such as SKU, unit price, quantity and total
Content
Name and price are required. A variant adds a second line and a quantity above one shows as × n; a long name is cut with an ellipsis, quantity and price never are.
Size
Regular has a 48 px thumbnail and its own padding, for a list directly in a card. Compact has a 40 px thumbnail and no padding, for a panel that brings its own.
- Nord standing deskOak, 160 × 80 cm$649.00
- Aria task chairGraphite, mesh back$389.00
- Nord standing deskOak, 160 × 80 cm$649.00
- Aria task chairGraphite, mesh back$389.00
Image
Pass an image for the photo. Without one the thumbnail is a tinted tile with an icon, in one of nine tints.
Trailing
The trailing slot sits between text and price, for a quantity stepper or a remove button. The row itself is display only, so give every control its own accessible name.
Price
The price is a node, not a number. Pass formatted text, or a discounted price with the old one struck through.
Behavior and motion
How the row treats its content, width and slot. It is display only, so it has no hover, focus or keyboard behaviour of its own.
- A row, not a control
- Line Item renders one div with no role and nothing to focus. Controls you put in the trailing slot keep their own focus ring and keyboard behaviour, and nothing in the row reacts to hover.
- Quantity
- A quantity adds × n after the name, only above one. It stays visible when a long name is cut; skip it when a stepper in the trailing slot already shows the quantity.
- Long text
- The name and variant are each one line and end in an ellipsis when the row is too narrow. The price and trailing slot never shrink, so keep the trailing content small.
- Image
- With an image the thumbnail is the photo, cropped to a square. Without one, the tile takes a tint (yellow by default) and a package icon; a broken address leaves an empty tile.
- Size
- Regular pads the row and uses a 48 px thumbnail. Compact has no padding and a 40 px thumbnail, so use it inside a panel that has padding already; a class can override either.
- Updates
- The row has no live region. When a stepper changes the quantity and the price, announce the new total yourself, for example with a polite live subtotal as the cart example does.
- Motion and reduced motion
- Nothing in the row is animated, so there is nothing to reduce. The controls you put in the trailing slot bring their own transitions.
Anatomy
The parts of a line item, numbered in the figure. One component draws the image, name, quantity, variant and price; the trailing slot is for your own content, here a quantity stepper.
- 1data-slot="line-item"
A div that lays the parts out in one row, 12 px apart. A regular row has 16 px side and 12 px vertical padding, a compact row none; it has no role, border or background of its own.
- 2data-slot="product-image"
The thumbnail, 48 px square (40 px compact) with 8 px corners. It shows the image, or a tinted tile with a package icon when there is none, and the photo has an empty alt.
- 3
The product name in 12 px medium text. It is cut with an ellipsis when the row is too narrow.
- 4Optional
× n after the name in the tertiary text colour. It is drawn only above one and is never cut.
- 5Optional
A second line under the name in 11 px tertiary text, for the colour, size or plan. It is cut with an ellipsis.
- 6Optional
A slot between the text and the price for your own controls, such as a quantity stepper or a remove button.
- 7
The price of the line in 12 px semibold text. It can hold a discounted price, and it is never cut or wrapped.
Best practices
- Do
Pass the price already formatted with the currency, like $649.00. The row formats no numbers, and the total of a line (unit price times quantity) is yours to calculate.
- Do
Use the compact size inside a panel that brings its own padding, such as an order summary. Use regular, the default, for a list directly in a card with dividers between rows.
- Do
Put the lines in a list so a screen reader announces how many products there are. The row itself is a div with no role.
- Do
Give every control in the trailing slot a name that includes the product, like Remove Nord standing desk. Several buttons named Remove can't be told apart.
- Do
Show a discounted price with the old price struck through and screen-reader text for both (Was, Now). Colour and a line-through alone don't say which one is current.
- Don’t
Don't pass a quantity of 1 and expect × 1. The quantity is drawn only above one; when a stepper in the trailing slot shows it, leave quantity out so it isn't written twice.
- Don’t
Don't put a long sentence in the variant. It is one line and is cut with an ellipsis, so keep it to the choices the buyer made.
- Don’t
Don't expect the row to be a link. It has no click handler or focus; to open the product, put a link in the name or wrap the row in your own.
API reference
Line Item is one component with the props below. It renders a div, and the API list holds the props the library adds.
A div that lays the parts out in one row, 12 px apart. A regular row has 16 px side and 12 px vertical padding, a compact row none; it has no role, border or background of its own.
| Prop | Type | Default | Description |
|---|---|---|---|
| name required | ReactNode | — | The product name. It is cut with an ellipsis on one line when the row is too narrow. It can be a node, for example a link. |
| price required | ReactNode | — | The price of the line, already formatted. It is a node, so it can hold a discounted price. It stays on one line and never shrinks. |
| variant | ReactNode | — | The second line under the name, for the colour, the size or the plan. It is cut with an ellipsis. Omit it for a row with one line of text. |
| quantity | number | — | The number of items. It adds after the name when it is above one, and nothing when it is one or not set. |
| image | string | — | The address of the product photo. Without it the thumbnail is a tinted tile with an icon. |
| tint | "indigo" | "blue" | "purple" | "pink" | "red" | "orange" | "yellow" | "green" | "alternative" | "yellow" | The tint of the placeholder tile: indigo, blue, purple, pink, red, orange, yellow, green or alternative. Yellow by default. Not used with . |
| size | "compact" | "regular" | "regular" | (default) is a 48 px thumbnail in a row with padding. is a 40 px thumbnail with no padding, for use inside a panel that has its own. |
| trailing | ReactNode | — | Content between the text and the price, such as a quantity stepper or a remove button. It does not shrink. |
| className | string | — | Added to the row. Use it for the width, the padding or a divider. |
Notes for AI
Give your coding assistant the Markdown reference instead of screenshots.
get_component("line-item")The full library index for assistants is at /llms.txt.
Related components
Recent invoicesInvoices issued in the last 30 days Invoice Status Customer Amount INV-2041 Paid WunderUI $24,800.00 INV-2040 Open Halcyon Labs $3,200.00 INV-2039 Overdue Pergola Foods $980.00 INV-2038 Paid Marlow & Finch $12,400.00 Total Sum$41,380.00 Core Elements5 stylesTableRows and columns with 23 ready-made cell types; for sorting and search use Data Table.