Custom field
If you make a custom field. Please share it with the community! (Make a PR)
Forget the label, help and error messages.
Extend existing component, instead of creating a custom field
Steps to create a custom field
1. Create a Field class that extends BaseField
namespace YourNameSpace;
use Tanthammar\TallForm\BaseField;
class MyField extends BaseField
{
public $specialProp; //example adding your own properties
// all properties that exists in BaseField or its traits should be set in the overrides() method.
public function overrides(): self
{
$this->type = 'my-field'; //required property!
return $this;
}
//now your field has access to all BaseField methods, you can override them or add your own
public function specialProp($prop): self
{
$this->specialProp = $prop;
return $this;
}
}2. Create a Blade component class, with the same name
3. Create a blade component view
4. Use your field in a form component
Please share your field!
Last updated
Was this helpful?