Hero
emrocode/heroFreeComponent
A simple hero banner component
Install it
npx shadcn@latest add https://style.emroco.de/r/hero.jsonSource
1import type * as React from "react";2import { cn } from "@/lib/utils";34function Hero({ className, ...props }: React.ComponentProps<"section">) {5 return (6 <section7 data-slot="hero"8 className={cn("border-border border-b", className)}9 {...props}10 />11 );12}1314function HeroContent({ className, ...props }: React.ComponentProps<"div">) {15 return (16 <div17 data-slot="hero-content"18 className={cn(19 "container flex flex-col items-center py-20 text-center md:py-32",20 className,21 )}22 {...props}23 />24 );25}2627type HeroAlertProps =28 | ({ href: string } & React.ComponentProps<"a">)29 | ({ href?: undefined } & React.ComponentProps<"span">);3031const heroAlertClassName =32 "mb-8 max-w-2xl w-fit border-y border-y-background/10 inline-flex shadow-xs shadow-inner items-center rounded-full ring ring-border bg-muted px-3 py-1.5 text-sm font-medium text-muted-foreground";3334function HeroAlert(props: HeroAlertProps) {35 if ("href" in props && props.href) {36 const { href, className, ...anchorProps } = props;3738 return (39 <a40 data-slot="hero-alert"41 href={href}42 className={cn(43 heroAlertClassName,44 "transition-colors hover:bg-muted/80",45 className,46 )}47 {...anchorProps}48 />49 );50 }5152 const { className, ...spanProps } = props;5354 return (55 <span56 data-slot="hero-alert"57 className={cn(heroAlertClassName, className)}58 {...spanProps}59 />60 );61}6263function HeroTitle({ className, ...props }: React.ComponentProps<"h1">) {64 return (65 <h166 data-slot="hero-title"67 className={cn(68 "mx-auto max-w-3xl pb-6 font-bold text-4xl tracking-tight md:text-5xl",69 className,70 )}71 {...props}72 />73 );74}7576function HeroDescription({ className, ...props }: React.ComponentProps<"p">) {77 return (78 <p79 data-slot="hero-description"80 className={cn(81 "mx-auto mt-2 max-w-2xl text-base text-muted-foreground leading-relaxed md:text-lg",82 className,83 )}84 {...props}85 />86 );87}8889function HeroActions({ className, ...props }: React.ComponentProps<"div">) {90 return (91 <div92 data-slot="hero-actions"93 className={cn(94 "mt-6 flex flex-wrap items-center justify-center gap-3 sm:justify-start",95 className,96 )}97 {...props}98 />99 );100}101102function Highlight({103 className,104 variant = "default",105 ...props106// … truncated
Files it writes
More from emrocode
All 6 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| GitHub Cornergithub-corner | emrocode | Components | Free | no deps | |
| Theme Providertheme-provider | emrocode | Components | Free | 1 dep · 3 files |
