Button
Buttons with variants, icons, loading states, confirmation dialogs, and ripple effects.
Variants
JavaScript Initialisation
Click a button to see output...
PHP PHP Methods (Fluent)
| Method / Property | Parameters | Description |
|---|
$m->button($id, $text) | string, string | Create a button component. |
->primary() | | Apply primary (blue) styling. |
->secondary() | | Apply secondary styling. |
->danger() | | Apply danger (red) styling. |
->success() | | Apply success (green) styling. |
->block() | | Make the button full-width. |
->loading() | | Show a loading spinner. |
->icon($icon) | string | Set a Font Awesome icon. |
->type($type) | string | Set the button type: button, submit, reset. |
->name($name) | string | Set the name attribute. |
->confirm($message) | string | Show a browser confirm dialog before the click fires. |
->on($event, $handler) | string, string | Attach a JS event handler. |
JS JS Methods
| Method / Property | Parameters | Description |
|---|
m.button(id, options) | string, ?object | Initialise or get a button instance. |
enable() | | Remove the disabled state. |
disable() | | Add the disabled state. |
setText(text) | string | Update button text (preserves icon). |
setLoading(loading) | boolean | Toggle loading spinner and disable state. |
icon(faName, position) | string, string | Set or replace the icon. Position: "left" or "right". |
EVENT Events
| Event Name | Detail | Description |
|---|
click | | Standard DOM click event. Includes ripple animation. |