पेज · Laravilt
Custom Fields
Create your own form field types with a PHP class and a Vue or React component.
A custom field has two parts:
- A PHP class that extends
Laravilt\Forms\Components\Fieldand passes its options to the frontend intoLaraviltProps(). - A frontend component (Vue or React) registered as
laravilt-{kebab-name}.
Generate both with:
bash
React support requires Laravilt v1.1 or later.
This creates app/Forms/Components/EmojiPicker.php and resources/js/components/forms/emoji-picker.vue (or .tsx).
Before building a field, check the built-in ones. For example, RateInput already covers star ratings.
Pages
- Creating Fields: write the PHP field class
- Frontend Components: build and register the Vue or React component