Feature Item C
Component that represents a feature or functionality.
Preview
01
Premium Feature
This is made out of metal or a super strong structure
Unique Feature
This is made out of metal or a super strong structure
Unique Feature
This is made out of metal or a super strong structure
Advanced Feature
This is made out of metal or a super strong structure
Advanced Feature
This is made out of metal or a super strong structure
Code
import React from "react"; import styles from "./feature-item-c.module.css"; type Props = { className?: string; children?: React.ReactNode; title: React.ReactNode; description?: React.ReactNode; icon?: React.ReactNode; secondaryIcon?: React.ReactNode; href?: string; rounded?: "none" | "small" | "medium" | "large"; shadow?: "none" | "medium"; // Put additional variants here, then define them in the CSS variant?: "default" | "red" | "simple" | "blue" | "blue-white" | "blue-simple"; }; export default function FeatureItemC({ className, children, title, description, icon, secondaryIcon, href, rounded = "small", shadow = "none", variant = "default", }: Props) { const content = ( <div className={[ styles["wrapper"], styles[`r-${rounded}`], styles[`sh-${shadow}`], styles[`variant-${variant}`], (shadow = "none"), className, ].join(" ")} > <div className={styles["content"]}> {secondaryIcon && ( <div className={styles["icon-secondary"]}>{secondaryIcon}</div> )} <div className={styles["header"]}> {icon && <div className={styles["icon"]}>{icon}</div>} {title && <h4 className={styles["title"]}>{title}</h4>} </div> {description && <p className={styles["desc"]}>{description}</p>} {children && <div className={styles["desc"]}>{children}</div>} </div> </div> ); if (href) { // Replace the "a" element with "Link" if you use Next.js, react-router ... return ( <a href={href} className={styles["link"]}> {content} </a> ); } else { return <>{content}</>; } }
Design
Figma design file:
Documentation
Properties
Props of the component:
className
(string): Specifies the CSS class of the component.children
(ReactNode): React children of the component. Specifies the ReactNode placed inside 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.icon
(ReactNode): Specifies the main icon component.secondaryIcon
(ReactNode): Specifies the secondary icon component.href
(string): Specifies the URL if the component is a link.rounded
("none" | "small" | "medium" | "large"): Specifies the border radius of the frame.shadow
("none" | "medium"): Specifies the size of the shadow of the frame.variant
("default" | "red" | "simple" | "blue" | "blue-white" | "blue-simple" 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.
Sample CSS customization
.variant-blue { --bg-color: #632aff; --fg-color: rgba(255, 255, 255, 0.6); padding: 2rem; } .variant-blue .icon, .variant-blue .title { color: rgba(255, 255, 255, 1); }