button() html()

A button, or a link styled as one, in Bootstrap colours and sizes.

html()->button($text = '', $extra = [])

Options

OptionMeaning
typeprimary, success... or link.
outline, size, iconOutline style; sm / lg; icon class.
link, target, relMake it an <a>: a trusted URL (javascript:, data:, vbscript: become #).
button_type, name, value, active, disabledOf a <button>: submit / reset...
class, class_add, id, title, style, no_escape, data-*, attrclass replaces the btn classes.

Example

A link

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