Input Group

입력 필드에 애드온, 버튼, 보조 콘텐츠를 추가합니다.

12 results
examples/krds/input-group-demo.tsx
import { Search } from "lucide-react"

import {

설치

pnpm dlx shadcn@latest add https://krdscn.gwlee.kr/r/input-group.json

사용법

import {
  InputGroup,
  InputGroupAddon,
  InputGroupButton,
  InputGroupInput,
  InputGroupText,
  InputGroupTextarea,
} from "@/components/ui/input-group"
<InputGroup>
  <InputGroupInput placeholder="Search..." />
  <InputGroupAddon>
    <SearchIcon />
  </InputGroupAddon>
</InputGroup>

구성

다음 조합으로 InputGroup:

InputGroup
├── InputGroupInput or InputGroupTextarea
├── InputGroupAddon
├── InputGroupButton
└── InputGroupText

정렬

Use the align prop on InputGroupAddon to position the addon relative to the input.

For proper focus management, InputGroupAddon should always be placed after InputGroupInput or InputGroupTextarea in the DOM. Use the align prop to visually position the addon.

inline-start

Use align="inline-start" to position the addon at the start of the input. This is the default.

Icon positioned at the start.

examples/krds/input-group-inline-start.tsx
import { SearchIcon } from "lucide-react"

import {

inline-end

Use align="inline-end" to position the addon at the end of the input.

Icon positioned at the end.

examples/krds/input-group-inline-end.tsx
import { EyeOffIcon } from "lucide-react"

import {

block-start

Use align="block-start" to position the addon above the input.

Full Name

Header positioned above the input.

script.js

Header positioned above the textarea.

examples/krds/input-group-block-start.tsx
import { CopyIcon, FileCodeIcon } from "lucide-react"

import {

block-end

Use align="block-end" to position the addon below the input.

USD

Footer positioned below the input.

0/280

Footer positioned below the textarea.

examples/krds/input-group-block-end.tsx
import {
  Field,
  FieldDescription,

예제

Icon

examples/krds/input-group-icon.tsx
import {
  CheckIcon,
  CreditCardIcon,

Text

$
USD
https://
.com
@company.com
120 characters left
examples/krds/input-group-text.tsx
import {
  InputGroup,
  InputGroupAddon,

Button

https://
examples/krds/input-group-button.tsx
"use client"

import * as React from "react"

Kbd

⌘K
examples/krds/input-group-kbd.tsx
import { SearchIcon } from "lucide-react"

import {
examples/krds/input-group-dropdown.tsx
import { ChevronDownIcon, MoreHorizontal } from "lucide-react"

import {

Spinner

Saving...
Please wait...
examples/krds/input-group-spinner.tsx
import { LoaderIcon } from "lucide-react"

import {

Textarea

Line 1, Column 1
script.js
examples/krds/input-group-textarea.tsx
import { CopyIcon as IconCopy, CornerDownLeftIcon as IconCornerDownLeft, FileCode2Icon as IconBrandJavascript, RefreshCwIcon as IconRefresh } from "lucide-react"

import {

Custom Input

Add the data-slot="input-group-control" attribute to your custom input for automatic focus state handling.

Here's an example of a custom resizable textarea from a third-party library.

examples/krds/input-group-custom.tsx
"use client"

RTL

RTL 지원을 활성화하려면 RTL 설정 가이드를 참고하세요.

١٢ نتيجة
جاري الحفظ...
٠/٢٨٠

تذييل موضع أسفل منطقة النص.

examples/krds/input-group-rtl.tsx
"use client"

import * as React from "react"

API 참조

InputGroup

The main component that wraps inputs and addons.

속성타입기본값
classNamestring
<InputGroup>
  <InputGroupInput />
  <InputGroupAddon />
</InputGroup>

InputGroupAddon

Displays icons, text, buttons, or other content alongside inputs.

Focus Navigation

For proper focus navigation, the InputGroupAddon component should be placed after the input. Set the align prop to position the addon.

속성타입기본값
align"inline-start" | "inline-end" | "block-start" | "block-end""inline-start"
classNamestring
<InputGroupAddon align="inline-end">
  <SearchIcon />
</InputGroupAddon>

For <InputGroupInput />, use the inline-start or inline-end alignment. For <InputGroupTextarea />, use the block-start or block-end alignment.

The InputGroupAddon component can have multiple InputGroupButton components and icons.

<InputGroupAddon>
  <InputGroupButton>Button</InputGroupButton>
  <InputGroupButton>Button</InputGroupButton>
</InputGroupAddon>

InputGroupButton

Displays buttons within input groups.

속성타입기본값
size"xs" | "icon-xs" | "sm" | "icon-sm""xs"
variant"default" | "destructive" | "outline" | "secondary" | "ghost" | "link""ghost"
classNamestring
<InputGroupButton>Button</InputGroupButton>
<InputGroupButton size="icon-xs" aria-label="Copy">
  <CopyIcon />
</InputGroupButton>

InputGroupInput

Replacement for <Input /> when building input groups. This component has the input group styles pre-applied and uses the unified data-slot="input-group-control" for focus state handling.

속성타입기본값
classNamestring

All other props are passed through to the underlying <Input /> component.

<InputGroup>
  <InputGroupInput placeholder="Enter text..." />
  <InputGroupAddon>
    <SearchIcon />
  </InputGroupAddon>
</InputGroup>

InputGroupTextarea

Replacement for <Textarea /> when building input groups. This component has the textarea group styles pre-applied and uses the unified data-slot="input-group-control" for focus state handling.

속성타입기본값
classNamestring

All other props are passed through to the underlying <Textarea /> component.

<InputGroup>
  <InputGroupTextarea placeholder="Enter message..." />
  <InputGroupAddon align="block-end">
    <InputGroupButton>Send</InputGroupButton>
  </InputGroupAddon>
</InputGroup>

변경 내역

2025-10-06 InputGroup

Add the min-w-0 class to the InputGroup component when the control must shrink inside a flex container.