diff --git a/docs/app/components/content/examples/form-field/FormFieldErrorAnimationExample.vue b/docs/app/components/content/examples/form-field/FormFieldErrorAnimationExample.vue new file mode 100644 index 0000000000..3321761b23 --- /dev/null +++ b/docs/app/components/content/examples/form-field/FormFieldErrorAnimationExample.vue @@ -0,0 +1,47 @@ + + + diff --git a/docs/content/3.components/form-field.md b/docs/content/3.components/form-field.md index fe8be0a0c5..3b51d71f92 100644 --- a/docs/content/3.components/form-field.md +++ b/docs/content/3.components/form-field.md @@ -170,6 +170,36 @@ slots: :u-input{placeholder="Enter your email" class="w-full"} :: +## Examples + +### With error animation + +You can animate the `error` slot by using the `ui` prop. + +::component-example +--- +collapse: true +name: 'form-field-error-animation-example' +--- +:: + +::tip +You can also configure this globally in your `app.config.ts`: + +```ts +export default defineAppConfig({ + ui: { + formField: { + slots: { + error: 'data-[state=open]:animate-[fade-in_200ms_ease-out] data-[state=closed]:animate-[fade-out_200ms_ease-in]' + } + } + } +}) +``` + +:: + ## API ### Props diff --git a/src/runtime/components/FormField.vue b/src/runtime/components/FormField.vue index f8d8a3ff11..eb9c091b03 100644 --- a/src/runtime/components/FormField.vue +++ b/src/runtime/components/FormField.vue @@ -48,7 +48,7 @@ export interface FormFieldSlots {