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
Unknown error (8192): Common\Markdown::blockTable(): Implicitly marking parameter $block as nullable is deprecated, the explicit nullable type must be used instead in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/lib/common/Markdown.php on line 6 [0] in function {closure:/var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/debug.php:6} in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 444 [1] in function include in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 444 [2] in function Composer\Autoload\includeFile in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 322 [3] in function Composer\Autoload\ClassLoader->loadClass in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/public/php_controls_button.php on line 99
Unknown error (8192): Parsedown::blockSetextHeader(): Implicitly marking parameter $Block as nullable is deprecated, the explicit nullable type must be used instead in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/erusev/parsedown/Parsedown.php on line 715 [0] in function {closure:/var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/debug.php:6} in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 444 [1] in function include in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 444 [2] in function Composer\Autoload\includeFile in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 322 [3] in function Composer\Autoload\ClassLoader->loadClass in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/lib/common/Markdown.php on line 5 [4] in function include in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 444 [5] in function Composer\Autoload\includeFile in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 322 [6] in function Composer\Autoload\ClassLoader->loadClass in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/public/php_controls_button.php on line 99
Unknown error (8192): Parsedown::blockTable(): Implicitly marking parameter $Block as nullable is deprecated, the explicit nullable type must be used instead in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/erusev/parsedown/Parsedown.php on line 853 [0] in function {closure:/var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/debug.php:6} in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 444 [1] in function include in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 444 [2] in function Composer\Autoload\includeFile in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 322 [3] in function Composer\Autoload\ClassLoader->loadClass in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/lib/common/Markdown.php on line 5 [4] in function include in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 444 [5] in function Composer\Autoload\includeFile in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/vendor/composer/ClassLoader.php on line 322 [6] in function Composer\Autoload\ClassLoader->loadClass in /var/www/vhosts/plesk.groupe-dmx.fr/dev2.groupe-dmx.fr/public/php_controls_button.php on line 99
\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.