PHP Controls Bootstrap controls for PHP
\Bootstrap\Components\Button
Code
$button = new \Bootstrap\Components\Button('Touch Me!');
$button->id('my-button')->type('input')->class('bg-success-50');
$button->printHtml();
Result
Documentation
\Bootstrap\Components\Button
A component that enables you to easily write <button> control through PHP.
Usage
Instantiate the Button by passing a content.
$button = new \Bootstrap\Components\Button('Touch Me!');
// continued below...
Options
Button::options
| Option | Default | Description |
|---|---|---|
disabled |
false |
If the control is disabled |
Example:
// during init
$button = new \Bootstrap\Components\Button('Touch Me!', ['disabled' => true]);
// after init
$button->options('disabled', true);
Other properties
Button::content- The content of the buttonButton::icon- Sets the iconButton::type- Sets thetypeattributeButton::container- Sets the container/wrapper (default<button>)Button::size- Sets the size (lg,sm, etc.)Button::attr- Sets additinoal attributesButton::id- Sets theidattributeButton::class- Sets theclassattribute
Styling
To learn more about styling the <button>, see UI Buttons demo.
Finally, once you configured your button, you can now htmlPrint it!
$button->printHtml();
Credits
\Bootstrap\Components\Button is part of the lodev09/bootstrap-php package created by @lodev09.