primevue-mirror/apps/showcase/doc/iftalabel/InvalidDoc.vue

68 lines
1.4 KiB
Vue
Raw Normal View History

2024-09-17 11:34:59 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>When the form element is invalid, the label is also highlighted.</p>
</DocSectionText>
<div class="card flex justify-center">
<IftaLabel>
<InputText id="username" v-model="value" autocomplete="off" :invalid="!value" />
<label for="username">Username</label>
</IftaLabel>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value: '',
code: {
basic: `
<IftaLabel>
<InputText id="username" v-model="value" :invalid="!value" />
<label for="username">Username</label>
</IftaLabel>
`,
options: `
<template>
<div class="card flex justify-center">
2024-09-17 12:15:56 +00:00
<IftaLabel>
2024-09-17 11:34:59 +00:00
<InputText id="username" v-model="value" :invalid="!value" />
<label for="username">Username</label>
</IftaLabel>
</div>
</template>
2024-09-23 08:30:11 +00:00
<script>
2024-09-17 11:34:59 +00:00
export default {
data() {
return {
value: ''
}
}
}
<\/script>
`,
composition: `
<template>
<div class="card flex justify-center">
2024-09-17 12:15:56 +00:00
<IftaLabel>
2024-09-17 11:34:59 +00:00
<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>
`
}
};
}
};
</script>