-
Notifications
You must be signed in to change notification settings - Fork 2
Button
Viames Marino edited this page Feb 26, 2026
·
2 revisions
Pair\Html\FormControls\Button renders <button> controls with submit/reset/button modes and form-related attributes.
-
type(string $type): selfwhere type issubmit,reset, orbutton formaction(string $url): staticformenctype(string $type): static-
formmethod(string $method): static(getorpost) formnovalidate(bool $novalidate = true): staticformtarget(string $target): staticpopovertarget(string $elementId): static-
popovertargetaction(string $action): static(hide,show,toggle) render(): stringvalidate(): bool
- Default button type is
submit. - Caption text comes from inherited
caption(...). -
validate()always returnstrue. - Popover helpers generate
data-popovertargetanddata-popovertargetactionattributes.
Submit button with custom form endpoint:
$save = (new \Pair\Html\FormControls\Button('save'))
->caption('Save order')
->type('submit')
->formaction('/orders/save')
->formmethod('post')
->formenctype('multipart/form-data');
echo $save->render();Popover trigger button:
$help = (new \Pair\Html\FormControls\Button('help'))
->caption('Help')
->type('button')
->popovertarget('help-popover')
->popovertargetaction('toggle');See also: FormControl, Form, Toggle.