Fluid
하위 컴포넌트들이 컨테이너의 전체 폭을 차지하도록 해 주는 레이아웃 컴포넌트예요.
출처: 문서
본문
Fluid는 하위 컴포넌트들이 자기 컨테이너의 전체 폭을 차지하도록 해 주는 레이아웃 컴포넌트예요.
사용법 (Usage)
import { Fluid } from '@primereact/ui/fluid';
<Fluid></Fluid>
예제 (Examples)
기본 (Basic)
폼 컴포넌트를 늘려서 사용 가능한 컨테이너 폭을 채우게 해 줘요.
비교 (Comparison)
InputText 처럼 fluid 옵션을 가진 컴포넌트는 자기 컴포넌트의 전체 폭을 차지할 수 있어요. 그런데 매 컴포넌트마다 fluid 를 켜는 건 번거로울 수 있죠. 그럴 땐 내용을 Fluid 로 감싸는 게 더 쉬운 대안이에요.
fluid 속성을 가진 어떤 컴포넌트든 Fluid 컴포넌트 안에 중첩할 수 있어요. 마지막 예제에서 보듯이, 자식 컴포넌트의 fluid 속성이 fluid 컨테이너보다 우선순위가 높아요.
접근성 (Accessibility)
스크린 리더 (Screen Reader)
Fluid는 어떤 역할(role)이나 속성도 요구하지 않아요.
키보드 지원 (Keyboard Support)
이 컴포넌트에는 상호작용 요소가 포함되어 있지 않아요.
Fluid API
Fluid 컴포넌트의 API 문서예요
Fluid
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?: FluidInstance) => undefined | CSSProperties) | null | The style to apply to the component. |
| className | string | ((instance?: FluidInstance) => 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 | FluidInstance | 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: FluidInstance) => 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
Interfaces
| Label | Description | Data |
|---|---|---|
| PassThroughOptions | Defines passthrough(pt) options of Fluid component. | [object Object] |
Types
| Label | Description | Data |
|---|---|---|
| Instance | Instance of Fluid component. | [object Object] |
useFluid
Props
State
Exposes
Types
테마 (Theming)
CSS 클래스 (CSS Classes)
styled 모드에서 사용하는 클래스 이름 목록이에요.
| ClassName | Description |
|---|---|
| p-fluid | Class name of the root element |
디자인 토큰 (Design Tokens)
디자인 토큰 목록이에요.