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

114 lines
3.1 KiB
Vue
Raw Normal View History

2024-09-17 10:26:24 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>When the form element is invalid, the label is also highlighted.</p>
</DocSectionText>
2024-09-18 11:12:06 +00:00
<div class="card flex flex-wrap justify-center items-end gap-4">
2024-09-17 10:26:24 +00:00
<FloatLabel>
<InputText id="value1" v-model="value1" autocomplete="off" :invalid="!value1" />
<label for="value1">Username</label>
</FloatLabel>
<FloatLabel variant="in">
<InputText id="value2" v-model="value2" autocomplete="off" :invalid="!value2" />
<label for="value2">Username</label>
</FloatLabel>
<FloatLabel variant="on">
<InputText id="value3" v-model="value3" autocomplete="off" :invalid="!value3" />
<label for="value3">Username</label>
</FloatLabel>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
value1: '',
value2: '',
value3: '',
code: {
basic: `
<FloatLabel>
<InputText id="value1" v-model="value1" :invalid="!value1" />
<label for="value1">Username</label>
</FloatLabel>
<FloatLabel variant="in">
<InputText id="value2" v-model="value2" :invalid="!value2" />
<label for="value2">Username</label>
</FloatLabel>
<FloatLabel variant="on">
<InputText id="value3" v-model="value3" :invalid="!value3" />
<label for="value3">Username</label>
</FloatLabel>
`,
options: `
<template>
2024-09-18 11:12:06 +00:00
<div class="card flex flex-wrap justify-center items-end gap-4">
2024-09-17 10:26:24 +00:00
<FloatLabel>
<InputText id="value1" v-model="value1" :invalid="!value1" />
<label for="value1">Username</label>
</FloatLabel>
<FloatLabel variant="in">
<InputText id="value2" v-model="value2" :invalid="!value2" />
<label for="value2">Username</label>
</FloatLabel>
<FloatLabel variant="on">
<InputText id="value3" v-model="value3" :invalid="!value3" />
<label for="value3">Username</label>
</FloatLabel>
</div>
</template>
<script setup>
export default {
data() {
return {
value1: '',
value2: '',
value3: ''
}
}
}
<\/script>
`,
composition: `
<template>
2024-09-18 11:12:06 +00:00
<div class="card flex flex-wrap justify-center items-end gap-4">
2024-09-17 10:26:24 +00:00
<FloatLabel>
<InputText id="value1" v-model="value1" :invalid="!value1" />
<label for="value1">Username</label>
</FloatLabel>
<FloatLabel variant="in">
<InputText id="value2" v-model="value2" :invalid="!value2" />
<label for="value2">Username</label>
</FloatLabel>
<FloatLabel variant="on">
<InputText id="value3" v-model="value3" :invalid="!value3" />
<label for="value3">Username</label>
</FloatLabel>
</div>
</template>
<script setup>
import { ref } from 'vue';
2024-09-18 10:23:01 +00:00
const value1 = ref('');
const value2 = ref('');
const value3 = ref('');
2024-09-17 10:26:24 +00:00
<\/script>
`
}
};
}
};
</script>