feat(input): Allow to set "required" attribute

Fixes #163
This commit is contained in:
Nguyễn Hồng Quân
2023-07-03 17:29:11 +07:00
parent ae2eaf1bd4
commit c4627e4af2
3 changed files with 29 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import InputDisabledExample from './input/examples/InputDisabledExample.vue';
import InputHelperExample from './input/examples/InputHelperExample.vue';
import InputPrefixExample from './input/examples/InputPrefixExample.vue';
import InputSuffixExample from './input/examples/InputSuffixExample.vue'
import InputRequiredExample from './input/examples/InputRequiredExample.vue'
</script>
# Vue Input - Flowbite
@@ -30,7 +31,7 @@ import { ref } from 'vue'
const name = ref('')
</script>
<template>
<Input v-modal="name" placeholder="enter your first name" label="First name" />
<Input v-model="name" placeholder="enter your first name" label="First name" />
</template>
```
@@ -60,7 +61,18 @@ import { Input } from 'flowbite-vue'
</template>
```
<InputDisabledExample />
## Required
```vue
<script setup>
import { Input } from 'flowbite-vue'
</script>
<template>
<Input required placeholder="enter your first name" label="First name" />
</template>
```
<InputRequiredExample />
## Slot - Helper
```vue
@@ -112,4 +124,3 @@ import { Input, Button } from 'flowbite-vue'
```
<InputSuffixExample />

View File

@@ -0,0 +1,12 @@
<template>
<div class="vp-raw">
<Input v-model='name' required placeholder="enter your first name" label="First name">
</Input>
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { Input } from '../../../../src/index'
const name = ref('')
</script>