본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

InputGroup

원문 보기 위키 갱신

InputGroup은 입력 요소 옆에 텍스트, 아이콘, 버튼 등 다른 콘텐츠를 묶어서 보여주는 컴포넌트예요. 검색창 앞에 아이콘이나 단위를 붙이고 싶을 때 쓰기 좋아요.

출처: 문서

본문

사용법 (Usage)

import { InputGroup } from '@primereact/ui/inputgroup';
<InputGroup.Root>
    <InputGroup.Addon />
</InputGroup.Root>

예시 (Examples)

기본 (Basic)

입력 요소와 버튼이나 텍스트 라벨 같은 addon을 결합해요.

다중 (Multiple)

InputGroup 컴포넌트로 입력과 add-on을 감싸면 그룹이 만들어져요. 각 add-on 요소는 InputGroup.Addon 컴포넌트의 child로 정의돼요. 같은 그룹 안에 여러 add-on을 배치할 수 있어요.

버튼 (Button)

버튼은 입력 요소의 양쪽 어느 쪽에든 배치할 수 있어요.

체크박스 & 라디오 (Checkbox & Radio)

Checkbox와 RadioButton 컴포넌트를 같은 그룹 안에서 입력 요소와 결합할 수 있어요.

선택 (Select)

InputGroup 안에서 다른 add-on과 입력 요소와 함께 Select 컴포넌트를 사용할 수 있어요.

플로팅 라벨 (Float Label)

FloatLabel은 라벨을 폼 요소와 시각적으로 통합해 줘요. 더 자세한 내용은 FloatLabel 문서를 확인하세요.

Ifta 라벨 (Ifta Label)

IftaLabel은 필드 안쪽 상단 정렬 라벨을 만들 때 사용해요. 더 자세한 내용은 IftaLabel 문서를 확인하세요.

접근성 (Accessibility)

화면 낭독기 (Screen Reader)

InputGroup과 InputGroupAddon은 별도의 역할(role)이나 속성이 필요 없어요.

키보드 지원 (Keyboard Support)

컴포넌트는 어떤 상호작용 요소도 포함하지 않아요.

InputGroup API

InputGroup 컴포넌트의 API 문서예요.

InputGroupRoot

Props

Name Type Default Description
ref Ref null The reference to the component instance.
pIf boolean true Whether the component should be rendered.
style CSSProperties | ((instance?: InputGroupRootInstance) => undefined | CSSProperties) null The style to apply to the component.
className string | ((instance?: InputGroupRootInstance) => undefined | string) null The class name to apply to the component.
as null | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent | ReactElement<unknown, string | JSXElementConstructor> | Iterable<ReactNode, any, any> | ReactPortal | Promise null The component type to render.
asChild boolean false Whether the component should be rendered as a child component.
instance InputGroupRootInstance null The instance to pass to the component.
pt SafeRecord null The pass-through props to pass to the component.
ptOptions PassThroughOptions null The pass-through options to pass to the component.
unstyled boolean null Whether the component should be rendered without classes.
dt unknown null The design token to use for the component.
styles StylesOptions null The styles to use for the component.
render (instance: InputGroupRootInstance) => ReactNode null The render function to render the component with instance access.
children any null The children to render.

Accepts React.ReactNode for static content or a render function (instance: I) => React.ReactNode for instance access. Typed as any to avoid JSX type errors when used directly in templates. | | [key: string] | any | null | | | pt-{optionName}-* | - | null | Pass through attributes for customizing component. For more info, see Pass Through tab. |

State

Exposes

Name Type Default Description
rootProps UseInputGroupRootProps null Pre-built data attribute props for the root element.

Interfaces

Label Description Data
PassThroughOptions Defines passthrough(pt) options of InputGroup component. [object Object],[object Object]

Types

Label Description Data
Instance Instance of InputGroup component. [object Object]

InputGroupAddon

Props

Name Type Default Description
ref Ref null The reference to the component instance.
pIf boolean true Whether the component should be rendered.
style CSSProperties | ((instance?: InputGroupAddonInstance) => undefined | CSSProperties) null The style to apply to the component.
className string | ((instance?: InputGroupAddonInstance) => undefined | string) null The class name to apply to the component.
as null | string | number | bigint | boolean | ComponentClass<any, any> | FunctionComponent | ReactElement<unknown, string | JSXElementConstructor> | Iterable<ReactNode, any, any> | ReactPortal | Promise null The component type to render.
asChild boolean false Whether the component should be rendered as a child component.
instance InputGroupAddonInstance null The instance to pass to the component.
pt SafeRecord null The pass-through props to pass to the component.
ptOptions PassThroughOptions null The pass-through options to pass to the component.
unstyled boolean null Whether the component should be rendered without classes.
dt unknown null The design token to use for the component.
styles StylesOptions null The styles to use for the component.
render (instance: InputGroupAddonInstance) => ReactNode null The render function to render the component with instance access.
children any null The children to render.

Accepts React.ReactNode for static content or a render function (instance: I) => React.ReactNode for instance access. Typed as any to avoid JSX type errors when used directly in templates. | | [key: string] | any | null | | | pt-{optionName}-* | - | null | Pass through attributes for customizing component. For more info, see Pass Through tab. |

Exposes

Name Type Default Description
inputgroup undefined | null | InputGroupRootInstance null Instance of the InputGroup component.

Interfaces

Label Description Data
PassThroughOptions Defines passthrough(pt) options of InputGroupAddon component. [object Object]

Types

Label Description Data
Instance Instance of InputGroupAddon component. [object Object]

useInputGroup

Props

State

Exposes

Interfaces

Types

테마 (Theming)

CSS 클래스 (CSS Classes)

styled 모드에서 사용하는 클래스 이름 목록이에요.

ClassName Description
p-inputgroup Class name of the root element
ClassName Description
p-inputgroup-addon Class name of the root element

디자인 토큰 (Design Tokens)

디자인 토큰 목록이에요.

Token CSS Variable Description
inputgroup.addon.background --p-inputgroup-addon-background Background of addon
inputgroup.addon.border.color --p-inputgroup-addon-border-color Border color of addon
inputgroup.addon.color --p-inputgroup-addon-color Color of addon
inputgroup.addon.border.radius --p-inputgroup-addon-border-radius Border radius of addon
inputgroup.addon.padding --p-inputgroup-addon-padding Padding of addon
inputgroup.addon.min.width --p-inputgroup-addon-min-width Min width of addon
inputgroup.addon.font.weight --p-inputgroup-addon-font-weight Font weight of addon
inputgroup.addon.font.size --p-inputgroup-addon-font-size Font size of addon

더 알아보기 (Learn more)

  • InputGroup 서브 컴포넌트의 세부 API를 문서에서 살펴보세요.
  • 버튼과 Select를 같은 그룹에 조합해 복합 입력 UI를 만들어 보세요.