Vue IftaLabel 컴포넌트
IftaLabel은 인필드(infield) 상단 정렬 라벨을 만들 때 사용하는 컴포넌트예요. 입력 요소 안에 라벨이 들어가는 플로팅 라벨 변형으로, 입력값이 있을 때 라벨이 위로 올라가는 형태예요.
출처: 문서
본문
Vue Ifta Label
IftaLabel is used to create infield top aligned labels
Import
import IftaLabel from 'primevue/iftalabel';
Accessibility
Screen Reader IftaLabel은 어떤 role이나 속성도 필요로 하지 않아요. Keyboard Support 이 컴포넌트에는 인터랙티브 요소가 없어요.
Basic
IftaLabel은 입력 요소와 그 라벨을 감싸서 사용해요.
<IftaLabel>
<InputText id="username" v-model="value" />
<label for="username">Username</label>
</IftaLabel>
Invalid
폼 요소가 유효하지 않을 때는 라벨도 함께 강조돼요.
<IftaLabel>
<InputText id="username" v-model="value" :invalid="!value" />
<label for="username">Username</label>
</IftaLabel>
Composition API Example
<template>
<div class="card flex justify-center">
<IftaLabel>
<InputText id="username" v-model="value" :invalid="!value" />
<label for="username">Username</label>
</IftaLabel>
</div>
</template>
<script setup>
import { ref } from 'vue';
const value = ref('');
<\/script>
Ifta Label
Props
| Name | Type | Default | Description |
|---|---|---|---|
| dt | any | - | It generates scoped CSS variables using design tokens for the component. |
| pt | PassThrough | - | Used to pass attributes to DOM elements inside the component. |
| ptOptions | any | - | Used to configure passthrough(pt) options of the component. |
| unstyled | boolean | false | When enabled, it removes component related styles in the core. |
Slots
| Name | Parameters | Description |
|---|---|---|
| default | Function |
Pass Through Options
| Name | Type | Description |
|---|---|---|
| root | IftaLabelPassThroughOptionType | Used to pass attributes to the root's DOM element. |
| hooks | any | Used to manage all lifecycle hooks. |
Theming
CSS Classes
| Class | Description |
|---|---|
| p-iftalabel | Class name of the root element |
Design Tokens
| Token | CSS Variable | Description |
|---|---|---|
| iftalabel.color | --p-iftalabel-color | Color of root |
| iftalabel.focus.color | --p-iftalabel-focus-color | Focus color of root |
| iftalabel.invalid.color | --p-iftalabel-invalid-color | Invalid color of root |
| iftalabel.transition.duration | --p-iftalabel-transition-duration | Transition duration of root |
| iftalabel.position.x | --p-iftalabel-position-x | Position x of root |
| iftalabel.top | --p-iftalabel-top | Top of root |
| iftalabel.font.size | --p-iftalabel-font-size | Font size of root |
| iftalabel.font.weight | --p-iftalabel-font-weight | Font weight of root |
| iftalabel.input.padding.top | --p-iftalabel-input-padding-top | Padding top of input |
| iftalabel.input.padding.bottom | --p-iftalabel-input-padding-bottom | Padding bottom of input |