Mint Panel

Supply, price and quantity, with the total shown before the button. A price of "0.08 ETH" beside a quantity of 5 is not a number anyone should be multiplying in their head at a mint.

src/components/ui/mint-panel.tsx

About

From the component's own source, where it was written.

Default label formatters, hoisted out of the parameter list.

An arrow function written inline as a default parameter is a value the React Compiler cannot safely reorder, so it bails on the whole component and none of it gets auto-memoised. At module scope it is a stable reference and the component compiles.

Install

npx astralyx-ui add mint-panel

Usage

import { MintPanel } from '@/components/ui/mint-panel'

<MintPanel minted={3820} supply={5000} price={0.08} priceLabel="ETH" />

Composer

Change the props and the source below follows.

Astralyx Genesis
Minted3,820 / 5,000
Price
0.08 ETH
Total
0.08 ETH
3 of 5 left for this wallet
Props
tsx
<MintPanel
  minted={3820}
  supply={5000}
  price={0.08}
  priceLabel="ETH"
  maxPerWallet={5}
  alreadyMinted={2}
/>

Examples

Mint

API

Generated from the source, so it cannot fall behind the code. One table per exported component, then hooks, functions and types.

MintPanel

Extends Omit<ComponentProps<'div'>, 'title'>.

PropTypeDefaultDescription
titleReactNode——
mintednumberrequiredDrives the progress bar and the sold-out state.
supplynumberrequiredDrives the progress bar and the sold-out state.
pricenumber—A number so the total can be computed and shown before the button.
priceLabelstring—A number so the total can be computed and shown before the button.
maxPerWalletnumber—The cap is enforced against what is already held, not just the quantity in the box.
alreadyMintednumber0The cap is enforced against what is already held, not just the quantity in the box.
quantitynumber——
onQuantityChange(quantity: number) => void——
onMint() => void——
disabledbooleanfalse—
statusReactNode——
soldOutLabelReactNode'Sold out'—
mintedLabelReactNode'Minted'Precedes the minted-of-supply count.
priceRowLabelReactNode'Price'—
totalLabelReactNode'Total'—
quantityLabelstring'Quantity'Accessible name for the quantity field.
limitReachedLabelReactNode'Limit reached'Action label once the per-wallet cap is hit.
mintLabel(quantity: number) => ReactNodeDEFAULT_MINT_LABELAction label, given the chosen quantity.