--- title: CartCheckoutButton description: "The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart. Must be a descendent of a `CartProvider` component. \ " api_version: 2024-07 api_name: hydrogen-react source_url: html: https://shopify.dev/docs/api/hydrogen-react/2024-07/components/cartcheckoutbutton md: https://shopify.dev/docs/api/hydrogen-react/2024-07/components/cartcheckoutbutton.md --- # Cart​Checkout​Button The `CartCheckoutButton` component renders a button that redirects to the checkout URL for the cart. Must be a descendent of a `CartProvider` component. ## Props * children ReactNode required Any ReactNode elements. * as AsType Provide a React element or component to render as the underlying button. Note: for accessibility compliance, almost always you should use a `button` element, or a component that renders an underlying button. * buttonRef Ref\ A `ref` to the underlying button * defaultOnClick (event?: MouseEvent\) => boolean | void A default `onClick` behavior Examples ### Examples * #### Example code ##### Description I am the default example ##### JavaScript ```jsx import {CartCheckoutButton} from '@shopify/hydrogen-react'; export default function ProductCartCheckoutButton() { return ; } ``` ##### TypeScript ```tsx import {CartCheckoutButton} from '@shopify/hydrogen-react'; export default function ProductCartCheckoutButton() { return ; } ```