button() html()
A button, or a link styled as one, in Bootstrap colours and sizes.
html()->button($text = '', $extra = [])Options
| Option | Meaning |
|---|---|
type | primary, success... or link. |
outline, size, icon | Outline style; sm / lg; icon class. |
link, target, rel | Make it an <a>: a trusted URL (javascript:, data:, vbscript: become #). |
button_type, name, value, active, disabled | Of a <button>: submit / reset... |
class, class_add, id, title, style, no_escape, data-*, attr | class replaces the btn classes. |
Example
Code
return html()->button('Default') . ' ' . html()->button('Primary', ['type' => 'primary'])
. ' ' . html()->button('Outline danger', ['type' => 'danger', 'outline' => 1])
. ' ' . html()->button('Edit', ['type' => 'success', 'size' => 'sm', 'icon' => 'fa fa-pencil'])
. ' ' . html()->button('A link', ['type' => 'info', 'link' => '#top'])
. ' ' . html()->button('Disabled', ['type' => 'secondary', 'disabled' => 1])
. ' ' . html()->button('', ['icon' => 'fa fa-trash', 'title' => 'Delete', 'type' => 'link']);Bootstrap 3 and 5
Bootstrap 3 uses btn-default for outline and the neutral button, btn-xs for sm.
See also: html/a, html/dropdown, demo:html/bs5_components