Card
adn-ui/cardFreeComponent
A container component displaying content, header, title, and footer.
Live preview
live · rendered by the registry
Rendered by adn-ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.awaiden.com/r/card.jsonSource
1"use client";23import "./card.css";4import type React from "react";5import { cn } from "tailwind-variants";67import { CardContext, useCardContext } from "./card.context";8import { cardVariants, type CardVariants } from "./card.variants";910export type CardProps = CardVariants & React.ComponentProps<"div">;1112export const CardRoot = ({ children, className, variant, ...props }: CardProps) => {13 const slots = cardVariants({ variant });1415 return (16 <CardContext.Provider value={{ slots }}>17 <div className={cn(slots.root(), className)} {...props}>18 {children}19 </div>20 </CardContext.Provider>21 );22};2324export type CardHeaderProps = React.ComponentProps<"div">;2526export const CardHeader = ({ className, ...props }: CardHeaderProps) => {27 const { slots } = useCardContext();28 return <div className={cn(slots.header(), className)} {...props} />;29};3031export type CardTitleProps = React.ComponentProps<"h3">;3233export const CardTitle = ({ className, ...props }: CardTitleProps) => {34 const { slots } = useCardContext();35 return <h3 className={cn(slots.title(), className)} {...props} />;36};3738export type CardDescriptionProps = React.ComponentProps<"p">;3940export const CardDescription = ({ className, ...props }: CardDescriptionProps) => {41 const { slots } = useCardContext();42 return <p className={cn(slots.description(), className)} {...props} />;43};4445export type CardContentProps = React.ComponentProps<"div">;4647export const CardContent = ({ className, ...props }: CardContentProps) => {48 const { slots } = useCardContext();49 return <div className={cn(slots.content(), className)} {...props} />;50};5152export type CardFooterProps = React.ComponentProps<"div">;5354export const CardFooter = ({ className, ...props }: CardFooterProps) => {55 const { slots } = useCardContext();56 return <div className={cn(slots.footer(), className)} {...props} />;57};
What it pulls in
npm packages
Files it writes
More from adn-ui
All 46 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | adn-ui | Components | Free | 2 deps · 5 files | |
| Alert Dialogalert-dialog | adn-ui | Components | Free | 2 deps · 5 files | |
| Aspect Ratioaspect-ratio | adn-ui | Components | Free | 1 dep · 5 files | |
| Autocompleteautocomplete | adn-ui | Components | Free | 2 deps · 5 files | |
| Avataravatar | adn-ui | Components | Free | 2 deps · 5 files | |
| Badgebadge | adn-ui | Components | Free | 1 dep · 5 files | |
| Breadcrumbbreadcrumb | adn-ui | Components | Free | 1 dep · 5 files | |
| Buttonbutton | adn-ui | Components | Free | 1 dep · 4 files |
