Yii2 Components - Text fields

Text fields

Text fields can be created either by using ActiveForm or Html classes.
vip9008\MDC\widgets\ActiveForm
vip9008\MDC\helpers\Html

ActiveForm

A basic usage looks like the following:

For more customizations. see Creating forms

<?php
use vip9008\MDC\widgets\ActiveForm;
use vip9008\MDC\helpers\Html;

$form = ActiveForm::begin(['themeColor' => 'blue']);
?>
    <?= $form->field($model, 'email') ?>
    <?= $form->field($model, 'bio', ['themeColor' => 'orange'])->textarea() ?>

    <div class="mdc-button-group">
        <?= Html::submitButton('Save', ['class' => 'mdc-button btn-contained bg-blue']) ?>
    </div>

<?php ActiveForm::end(); ?>

Html

A basic usage looks like the following:

email
Enter your email address
<?php
use vip9008\MDC\helpers\Html;

echo Html::textFieldInput(
    'email', // input name
    'example@gmail.com', // input value. defualt: null
    // input options. default: []
    [
        'themeColor' => 'blue',
        'class' => 'outlined full-width',
        'label' => 'Email address',
        'icon' => 'email',
        'hint' => 'Enter your email address',
    ]
);
?>
Talk about yourself
<?php
use vip9008\MDC\helpers\Html;

echo Html::textAreaInput(
    'bio', // input name
    null, // input value. defualt: null
    // input options. default: []
    [
        'themeColor' => 'blue',
        'class' => 'outlined full-width',
        'hint' => 'Talk about yourself',
    ]
);
?>