PHP Classes

File: site/demos/form-choices.php

Recommend this page to a friend!
  Packages of Boss Ibrahim Mussa   Caelrik   site/demos/form-choices.php   Download  
File: site/demos/form-choices.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Caelrik
Build Web user interface from PHP components
Author: By
Last change:
Date: 8 days ago
Size: 802 bytes
 

 

Contents

Class file image Download
<?php

use Caelrik\Ui\Components\Form;
use Caelrik\Ui\Components\Form\Field;

return Form::make('preferences')
    ->action('/preferences')
    ->add(
        Field::radio('plan', ['free' => 'Free', 'team' => 'Team', 'business' => 'Business'])->required(),
        Field::checkboxes('topics', ['news' => 'News', 'releases' => 'Releases', 'security' => 'Security'], 'Topics')
            ->inline()
            ->required()
            ->help('Choose at least one.'),
        Field::switch('newsletter', 'Monthly newsletter')->value(true),
        Field::range('volume', 'Notification volume')->min(0)->max(10)->value(6),
        Field::color('accent', 'Accent color')->value('#0d6efd'),
        Field::rating('experience', 'How was your experience?')->value(4),
    )
    ->submit('Save preferences');