Pricing C

Component that represents a price list item.

Preview

Premium

$59
per month

Suitable for any business with less than 500 customers.

  • Unlimited users
  • 500 subscribers per month
  • Free support
  • No enterprise features

Standard

$59
per month

Suitable for any business with less than 500 customers.

  • Unlimited users
  • 500 subscribers per month
  • Free support
  • No enterprise features

Code

import React from "react"; import styles from "./pricing-c.module.css"; type FeatureType = { title: string; unavailable?: boolean; }; type Props = { className?: string; title: React.ReactNode; description?: React.ReactNode; callToActionText?: string; callToActionElement?: React.ReactNode; price?: React.ReactNode; priceUnit?: React.ReactNode; features?: FeatureType[]; availableIcon?: React.ReactNode; unavailableIcon?: React.ReactNode; href?: string; align?: "start" | "center" | "end"; rounded?: "none" | "small" | "medium" | "large"; shadow?: "none" | "medium"; // Put additional variants here, then define them in the CSS variant?: "default" | "red"; }; export default function PricingC({ className, title, description, callToActionText, callToActionElement, price, priceUnit, features = [], availableIcon = "+", unavailableIcon = "-", href, align = "center", rounded = "medium", shadow = "none", variant = "default", }: Props) { return ( <div className={[ styles["wrapper"], styles[`al-${align}`], styles[`r-${rounded}`], styles[`sh-${shadow}`], styles[`variant-${variant}`], className, ].join(" ")} > {/* Title */} <header className={styles["header"]}> {title && <h4 className={styles["title"]}>{title}</h4>} </header> {/* Price */} <div className={styles["price-group"]}> {price && <div className={styles["price"]}>{price}</div>} {priceUnit && <div className={styles["price-unit"]}>{priceUnit}</div>} {description && <p className={styles["desc"]}>{description}</p>} </div> <div className={styles["content"]}> {/* Feature list */} {features && ( <ul className={styles["features"]}> {features.map((feature) => ( <li key={feature.title} className={[ styles["feature-item"], feature.unavailable && styles["feature-unavailable"], ].join(" ")} > <span className={styles["feature-icon"]}> {feature.unavailable ? unavailableIcon : availableIcon} </span> <span className={styles["feature-text"]}>{feature.title}</span> </li> ))} </ul> )} </div> <footer className={styles["footer"]}> {/* Call to action */} {/* Set the callToActionElement for a specific CTA component or use a simple callToActionText with the href props */} {callToActionElement } {/* Replace the "a" element with "Link" if you use Next.js */} {callToActionText && ( <a href={href} className={styles["btn-cta"]}> {callToActionText} </a> )} </footer> </div> ); }

Design

Figma design file:

Documentation

Properties

Props of the component:

  • className (string): Specifies the CSS class of the component.
  • title (string or ReactNode): Specifies the text or component that will be used as the title.
  • description (string or ReactNode): Specifies the text or component that will be used as the description.
  • callToActionText (string): Specifies the call to action text.
  • callToActionElement (ReactNode): Specifies the component used as the call to action.
  • price (string or ReactNode): Specifies the price.
  • priceUnit (string or ReactNode): Specifies the price unit.
  • features (array of FeatureType): Specifies the feature list.
  • availableIcon (ReactNode): Specifies the icon component of the available feature.
  • unavailableIcon (ReactNode): Specifies the icon component of the unavailable feature.
  • href (string): Specifies the URL if the component is a link.
  • align ("start" | "center" | "end"): Specifies the horizontal alignment of the content.
  • rounded ("none" | "small" | "medium" | "large"): Specifies the border radius of the frame.
  • shadow ("small" | "medium"): Specifies the size of the shadow of the frame.
  • variant ("default" | "red" | "card" or a customized value): Specifies the color or theme variant of the component. Check out the "Sample CSS customization" below for an example of how to use it.
FeatureType item arguments
  • title (string): Specifies the title text.
  • unavailable (boolean): Specifies if this feature is available or not.
Sample CSS customization
.variant-red { --fg-color: #f00d3e; --highlight-color: #f00d3e ; --highlight-fg-color: #ffffff; --bg-color: #f7cdd6; box-shadow: inset 0px 0px 2px 0px var(--shadow-color); } .variant-red .price-group{ background-image: linear-gradient(to bottom right, #632aff, #f00d3e); }