Cart Line Quantitycomponent
component
The component renders a
span
(or another element / component that can be customized by the as
prop) with the cart line's quantity.
It must be a descendent of a component, and uses the
hook internally.
Anchor to propsProps
- ComponentGeneric
An HTML tag or React Component to be rendered as the base element wrapper. The default is
span
.
CartLineQuantityBaseProps
- as
An HTML tag or React Component to be rendered as the base element wrapper. The default is `span`.
ComponentGeneric
interface CartLineQuantityBaseProps<
ComponentGeneric extends ElementType = 'span',
> {
/** An HTML tag or React Component to be rendered as the base element wrapper. The default is `span`. */
as?: ComponentGeneric;
}
Was this section helpful?
Example code
import {CartLineQuantity, CartLineProvider} from '@shopify/hydrogen-react';
export function Example({line}) {
return (
<CartLineProvider line={line}>
<CartLineQuantity />
</CartLineProvider>
);
}
examples
Example code
description
I am the default example
JavaScript
import {CartLineQuantity, CartLineProvider} from '@shopify/hydrogen-react'; export function Example({line}) { return ( <CartLineProvider line={line}> <CartLineQuantity /> </CartLineProvider> ); }
TypeScript
import {CartLineQuantity, CartLineProvider} from '@shopify/hydrogen-react'; import type {CartLine} from '@shopify/hydrogen-react/storefront-api-types'; export function Example({line}: {line: CartLine}) { return ( <CartLineProvider line={line}> <CartLineQuantity /> </CartLineProvider> ); }