Readme Badge Row
shieldcn/readme-badge-rowFreeComponent
Horizontal layout wrapper for multiple badges with consistent spacing, wrapping, and alignment. Pairs with ReadmeBadge.
Install it
npx shadcn@latest add https://shieldcn.dev/r/readme-badge-row.jsonSource
1/**2 * shieldcn3 * ReadmeBadgeRow4 * by Justin Levine5 * shieldcn.dev6 *7 * Horizontal layout wrapper for multiple badges with consistent spacing,8 * wrapping, and alignment. Works with ReadmeBadge or any inline elements.9 *10 * Props:11 * - gap?: spacing between badges ("xs" | "sm" | "md" | "lg", default "sm")12 * - align?: horizontal alignment ("left" | "center" | "right", default "left")13 * - className?: additional class names14 * - children: badge elements15 */1617import * as React from "react"18import { cn } from "@/lib/utils"1920const gapMap = {21 xs: "gap-1",22 sm: "gap-2",23 md: "gap-3",24 lg: "gap-4",25} as const2627const alignMap = {28 left: "justify-start",29 center: "justify-center",30 right: "justify-end",31} as const3233interface ReadmeBadgeRowProps extends React.ComponentProps<"div"> {34 /** Spacing between badges. @default "sm" */35 gap?: keyof typeof gapMap36 /** Horizontal alignment. @default "left" */37 align?: keyof typeof alignMap38 /** Additional class names. */39 className?: string40 children: React.ReactNode41}4243function ReadmeBadgeRow({44 gap = "sm",45 align = "left",46 className,47 children,48 ...props49}: ReadmeBadgeRowProps) {50 return (51 <div52 data-slot="readme-badge-row"53 className={cn(54 "flex flex-wrap items-center",55 gapMap[gap],56 alignMap[align],57 className58 )}59 {...props}60 >61 {children}62 </div>63 )64}6566export { ReadmeBadgeRow }67export type { ReadmeBadgeRowProps }
Files it writes
More from shieldcn
All 3 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Badge Previewbadge-preview | shieldcn | Components | Free | no deps | |
| Readme Badgereadme-badge | shieldcn | Components | Free | no deps |
