Section Heading
shadcncraft/section-headingFreeComponent
A component that standardizes heading typography and spacing. This component includes a pre-heading label, main heading, and body text in different layout variants.
Live preview
live · rendered by the registry
Rendered by shadcncraft on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcncraft.com/r/section-heading.jsonSource
1import * as React from "react";23import { cn } from "@/lib/utils";4import { Tagline } from "@/components/shadcncraft/pro-marketing/tagline";56function SectionHeading({7 alignment = "left",8 size = "lg",9 className,10 ...props11}: React.ComponentProps<"div"> & { alignment?: "left" | "center"; size?: "sm" | "lg" }) {12 return (13 <div14 data-slot="section-heading"15 data-alignment={alignment}16 data-size={size}17 className={cn(18 "group/section-heading flex max-w-3xl flex-col gap-3",19 alignment === "left" && "items-start text-left",20 alignment === "center" && "mx-auto items-center text-center",21 className22 )}23 {...props}24 />25 );26}2728function SectionHeadingTagline({ ...props }: React.ComponentProps<typeof Tagline>) {29 return <Tagline variant="default" {...props} />;30}3132type HeadingTypes = "h2" | "h3" | "h4" | "h5" | "h6";33type HeadingProps<T extends HeadingTypes> = React.ComponentProps<T> & {34 as?: T;35};3637function SectionHeadingTitle<T extends HeadingTypes = "h2">({38 as,39 className,40 ...props41}: HeadingProps<T>) {42 const Comp = as ?? "h2";4344 return (45 <Comp46 data-slot="section-heading-title"47 className={cn(48 "cn-font-heading scroll-m-20 text-4xl font-medium tracking-tight text-balance group-data-[size=sm]/section-heading:text-3xl lg:text-5xl lg:group-data-[size=sm]/section-heading:text-4xl",49 className50 )}51 {...props}52 />53 );54}5556function SectionHeadingBody({ className, ...props }: React.ComponentProps<"div">) {57 return (58 <div59 data-slot="section-heading-body"60 className={cn("max-w-2xl text-base text-pretty text-muted-foreground", className)}61 {...props}62 />63 );64}6566function SectionHeadingActions({ className, ...props }: React.ComponentProps<"div">) {67 return (68 <div69 data-slot="section-heading-actions"70 className={cn("flex w-full flex-col gap-2 sm:w-fit sm:flex-row", className)}71 {...props}72 />73 );74}7576export {77 SectionHeading,78 SectionHeadingActions,79 SectionHeadingBody,80 SectionHeadingTagline,81 SectionHeadingTitle,82};
What it pulls in
Other registry items
Files it writes
More from shadcncraft
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Avatar Stackavatar-stack | shadcncraft | Components | Free | no deps | |
| Badgebadge | shadcncraft | Components | Free | no deps | |
| Featured Iconfeatured-icon | shadcncraft | Components | Free | no deps | |
| Image Zoomimage-zoom | shadcncraft | Components | Free | 1 dep | |
| Marqueemarquee | shadcncraft | Components | Free | no deps | |
| Page Headingpage-heading | shadcncraft | Components | Free | no deps | |
| Placeholder Logoplaceholder-logo | shadcncraft | Components | Free | no deps | |
| Profile Cardprofile-card | shadcncraft | Components | Free | no deps |
