supplyhog / yii2-clipboardjs
Installs: 103 542
Dependents: 1
Suggesters: 0
Security: 0
Stars: 8
Watchers: 3
Forks: 6
Open Issues: 2
Requires
- php: >=5.4.0
- bower-asset/clipboard: ^1.5
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-12-16 08:33:50 UTC
README
An easy way to use Clipboardjs in your project. Clipboardjs is a javascript only way to copy text to the clipboard.
Installation
Install this extension via composer. Add this line to your project’s composer.json
"supplyhog/yii2-clipboardjs" : "dev-master"
Usage
//Button to copy text <?= \supplyhog\ClipboardJs\ClipboardJsWidget::widget([ 'text' => "Hello World", // 'label' => 'Copy to clipboard', // 'htmlOptions' => ['class' => 'btn'], // 'tag' => 'button', ]) ?> //Button to copy text from input id <?= \supplyhog\ClipboardJs\ClipboardJsWidget::widget([ 'inputId' => "#input-url", // 'cut' => false, // Cut the text out of the input instead of copy? // 'label' => 'Copy to clipboard', // 'htmlOptions' => ['class' => 'btn'], // 'tag' => 'button', ]) ?>
Just the Asset?
Yes, you can use just the asset. php \supplyhog\ClipboardJs\ClipboardJsAsset::register($view)
It will auto init anything with the "clipboard-js-init" class.