Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 686 Bytes

x-errors.md

File metadata and controls

27 lines (21 loc) · 686 Bytes

X-Splade-Errors Component

You may use the Errors Component to show validation errors. For each key, Laravel returns an array of errors, so there's a helper method to retrieve the first error of the key:

<x-splade-errors>
    <p v-if="errors.has('name')" v-text="errors.first('name')" />
</x-splade-errors>

You may also access the array by using the key directly on the errors prop:

<x-splade-errors>
    <p>Name errors: <span v-text="errors.name.length" /></p>
</x-splade-errors>

Alternatively, you can loop through all errors:

<x-splade-errors>
    <div v-for="(errors, key) in errors.all">
        ...
    </div>
</x-splade-errors>