reactintermediatemitFeatured

React Pricing Cards

Data-driven pricing cards with props.

5.9k2.8k1.5k656

About this module

A fully data-driven pricing component. Pass plans as props and it renders a responsive grid with a highlighted tier.

#react#pricing#cards#props#data-driven

Source code

Installation

  1. 1

    Install dependencies

    Install React and the required packages.

    npm install react react-dom
  2. 2

    Create the component

    Create ReactPricingCards.tsx and paste the source below.

  3. 3

    Create the styles

    Create `styles.css` alongside the component and import it from the component file.

  4. 4

    Import and use

    Import the component in your page or layout and render it.

Usage

  1. 1

    Import the component

    Import ReactPricingCards from its file.

    import ReactPricingCards from "./components/ReactPricingCards";
  2. 2

    Render it

    Render the component in your JSX.

    export default function App() {
      return <ReactPricingCards />;
    }
Overview
Categorycomponents
Frameworkreact
Difficultyintermediate
Licensemit
Versionv1.0.0
Features
  • TypeScript-ready
  • Accessible by default
  • Component-scoped styles
Traits
  • ResponsiveYes
  • Dark modeYes
  • AccessibleYes
  • Production readyYes
Props
plansPlan[]

Array of pricing plans to display.

Default: []

highlightIndexnumber

Index of the plan to highlight.

Default: -1

currencystring

Currency symbol for prices.

Default: "$"

interval"month" | "year"

Billing interval label.

Default: "month"

Browser support
  • Chrome 90+
  • Firefox 90+
  • Safari 15+
  • Edge 90+

Related modules

Command Palette

Search modules and jump anywhere