spinner() html()

A loading indicator; with class_add htmx-indicator it shows while an htmx request runs.

html()->spinner($extra = [])

Options

OptionMeaning
typeborder (default) or grow.
size, color, textsm; a colour; screen reader text (default Loading...).
class_add, id, style, no_escape, data-*, attrAttributes.

Example

Loading... Loading... Saving...

Code

return html()->spinner() . ' ' . html()->spinner(['type' => 'grow', 'color' => 'success'])
    . ' ' . html()->spinner(['size' => 'sm', 'color' => 'danger', 'text' => 'Saving...']);

Bootstrap 3 and 5

Bootstrap 5 spinner-border / spinner-grow; Bootstrap 3 and 4 a spinning Font Awesome icon.

See also: html/placeholder, htmx/fragment