Tally UI

ProductStockBadge

Visual stock status indicator with colored dot and label

Import

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

Usage

<ProductStockBadge doc={productDocument} />
<ProductStockBadge doc={productDocument} showQuantity />

Renders a pill-shaped badge with status-appropriate colors:

  • In Stockbg-success/15 text-success
  • Out of Stockbg-danger/15 text-danger
  • On Backorderbg-warning/15 text-warning
  • Unknownbg-muted/15 text-muted

Props

PropTypeDefaultDescription
docanyrequiredRxDB product document
showQuantitybooleanfalseShow quantity alongside status
classNamestringOverride badge container styles

Trait mapping

ConnectorStock status sourceQuantity source
WooCommercedoc.stock_statusdoc.stock_quantity
MedusaDerived from variant.manage_inventory / inventory_quantitydoc.variants[0].inventory_quantity
ShopifyDerived from variant.inventory_management / inventory_policy / inventory_quantitydoc.variants[0].inventory_quantity
Vendurevariant.stockLevel string (IN_STOCK, OUT_OF_STOCK, LOW_STOCK)doc.variants[0].stockOnHand (Admin API only)

Live demo

On this page