Inline Text
alexcarpenter/inline-textFreeComponent
An inline text component with an icon slot that wraps perfectly with the text.
Install it
npx shadcn@latest add https://ui.alexcarpenter.me/r/inline-text.jsonSource
1import { cn } from "@/lib/utils"2import { Slot } from "@radix-ui/react-slot"34export function InlineText({5 className,6 asChild,7 ...props8}: React.ComponentProps<"span"> & {9 asChild?: boolean10}) {11 const Comp = asChild ? Slot : "span"1213 return (14 <Comp15 className={cn("relative inline-block pr-[1.25em]", className)}16 data-slot="inline-text"17 {...props}18 />19 )20}2122export function InlineTextIcon({23 className,24 ...props25}: React.ComponentProps<"span">) {26 return (27 <span28 className={cn(29 "absolute ml-[.25em] inline-flex h-[1lh] flex-none items-center [&>svg]:size-[1em]",30 className31 )}32 data-slot="inline-text-icon"33 {...props}34 />35 )36}
What it pulls in
npm packages
Files it writes
More from alexcarpenter
All 6 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Info Listinfo-list | alexcarpenter | Components | Free | 1 dep | |
| Pricing Tablepricing-table | alexcarpenter | Components | Free | 7 deps |
