BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/shadcn/input-group

input-group

shadcn/input-group
FreeComponent

shadcn publishes no description for this item.

Live preview

live · rendered by the registry
Rendered by shadcn on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add input-group

Source

ui/input-group.tsxui.shadcn.com/r/styles/new-york/input-group.json
1"use client"
2
3import * as React from "react"
4import { cva, type VariantProps } from "class-variance-authority"
5
6import { cn } from "@/lib/utils"
7import { Button } from "@/registry/new-york/ui/button"
8import { Input } from "@/registry/new-york/ui/input"
9import { Textarea } from "@/registry/new-york/ui/textarea"
10
11function InputGroup({ className, ...props }: React.ComponentProps<"div">) {
12 return (
13 <div
14 data-slot="input-group"
15 role="group"
16 className={cn(
17 "group/input-group border-input dark:bg-input/30 shadow-xs relative flex w-full items-center rounded-md border outline-none transition-[color,box-shadow]",
18 "h-9 has-[>textarea]:h-auto",
19
20 // Variants based on alignment.
21 "has-[>[data-align=inline-start]]:[&>input]:pl-2",
22 "has-[>[data-align=inline-end]]:[&>input]:pr-2",
23 "has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>[data-align=block-start]]:[&>input]:pb-3",
24 "has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-end]]:[&>input]:pt-3",
25
26 // Focus state.
27 "has-[[data-slot=input-group-control]:focus-visible]:ring-ring has-[[data-slot=input-group-control]:focus-visible]:ring-1",
28
29 // Error state.
30 "has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[[data-slot][aria-invalid=true]]:border-destructive dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40",
31
32 className
33 )}
34 {...props}
35 />
36 )
37}
38
39const inputGroupAddonVariants = cva(
40 "text-muted-foreground flex h-auto cursor-text select-none items-center justify-center gap-2 py-1.5 text-sm font-medium group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-[calc(var(--radius)-5px)] [&>svg:not([class*='size-'])]:size-4",
41 {
42 variants: {
43 align: {
44 "inline-start":
45 "order-first pl-3 has-[>button]:ml-[-0.45rem] has-[>kbd]:ml-[-0.35rem]",
46 "inline-end":
47 "order-last pr-3 has-[>button]:mr-[-0.4rem] has-[>kbd]:mr-[-0.35rem]",
48 "block-start":
49 "[.border-b]:pb-3 order-first w-full justify-start px-3 pt-3 group-has-[>input]/input-group:pt-2.5",
50 "block-end":
51 "[.border-t]:pt-3 order-last w-full justify-start px-3 pb-3 group-has-[>input]/input-group:pb-2.5",
52 },
53 },
54 defaultVariants: {
55 align: "inline-start",
56 },
57 }
58)
59
60function InputGroupAddon({
61 className,
62 align = "inline-start",
63 ...props
64// … truncated

What it pulls in

Other registry items

  • button
  • input
  • textarea

Files it writes

  • ui/input-group.tsx

Facts

Registry
shadcn
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-02
Last confirmed
yesterday

Go to the source

Docs on shadcn ui.shadcn.com shadcn-ui/ui on GitHub Raw registry item This item as JSON

More from shadcn

All 62 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionshadcnComponentsFreeno deps
alertalertshadcnComponentsFreeno deps
alert-dialogalert-dialogshadcnComponentsFreeno deps
aspect-ratioaspect-ratioshadcnComponentsFreeno deps
attachmentattachmentshadcnComponentsFreeno deps
avataravatarshadcnComponentsFreeno deps
badgebadgeshadcnComponentsFreeno deps
breadcrumbbreadcrumbshadcnComponentsFreeno deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex