Btn
Basic Usage
A clickable button.
use Hiker\Components\Btn\Btn;
Btn::make('optional-unique-identifier')
->label('CTA Primary')
->type('button')
->method('POST')
->href('/my/url')
->modifiers([/*...*/]);
Methods
Href
Btn::href(string $href)
Sets the URL to be called by the button.
$btn->href('/my/url');
Route
Btn::route(string $route, array $parameters)
Sets the URL using a defined Hiker route.
$btn->route('client.resource.draft', ['resource' => 'foo']);
Method
Btn::method(string $method)
Sets the HTTP method to use for the ajax request when the button is clicked.
$btn->method('POST');
Data
Btn::data(array $data)
Sets the data that should be sent along with the request.
$btn->data(['product' => 'product-identifier']);
Label
Btn::label(string $label)
Sets the button text.
$btn->label('CTA Primary');
Type
Btn::type(string $type)
Sets the type of button. Accepted values: link
, button
, submit
.
$btn->type('submit');
Modifiers
Btn::modifiers(array $modifiers)
Sets the modifiers to apply on the button. Available modifiers are:
-
secondary
-
icon
-
small
$btn->modifiers(['small', 'secondary']);
Icon
Btn::icon(string $icon)
Sets the icon to display in the button. Note: you must also include the icon
modifier with the method described above.
$btn->icon('plus');
Status
Btn::status(string $status)
Sets the button status. Accepted values: success
, disabled
.
$btn->status('success');