PHP code example of sandritsch91 / yii2-widget-autosize

1. Go to this page and download the library: Download sandritsch91/yii2-widget-autosize library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sandritsch91 / yii2-widget-autosize example snippets


use sandritsch91\yii2-widget-autosize\Autosize;

echo Autosize::widget([
    'model' => $model,                          // The model to be used in the form
    'attribute' => 'content',                   // The attribute to be used in the form
    'htmlClass' => yii\bootstrap5\Html::class,  // Optional. The class used to generate the form field
    'clientEvents' => [                         // Optional. Pass the client events to be attached to the textarea
        'autosize:resized' => 'function() { console.log("resized"); }'
    ]
]);

use sandritsch91\yii2-widget-autosize\Autosize;

echo $form->field($model, 'content')->widget(Autosize::class, [
    'clientEvents' => [
        'autosize:resized' => 'function() { console.log("resized"); }'
    ]
]);

use sandritsch91\yii2-widget-autosize\Autosize;

echo Autosize::widget([
    'name' => 'myText',         // The name of the input
    'value' => 'Hello World',   // The value of the input
    'clientEvents' => [
        'autosize:resized' => 'function() { console.log("resized"); }'
    ]
]);