PHP Classes

File: site/demos/theme-builder.php

Recommend this page to a friend!
  Packages of Boss Ibrahim Mussa   Caelrik   site/demos/theme-builder.php   Download  
File: site/demos/theme-builder.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: 1,159 bytes
 

 

Contents

Class file image Download
<?php

use Caelrik\Ui\Components\Form;
use Caelrik\Ui\Components\Form\Field;
use Caelrik\Ui\Components\Grid;
use Caelrik\Ui\Components\ThemeBuilder;
use Caelrik\Ui\Theme\Theme;

// Export downloads the theme; nothing is saved here (no saveUrl()).
return ThemeBuilder::make('builder')
    ->theme(Theme::preset('bootstrap'))
    ->preview(
        Form::make('preview-form')
            ->add(
                Field::text('name')->required(),
                Field::email('email', 'E-mail')->required()->help('We never share your e-mail.'),
                Field::checkbox('terms', 'I accept the terms'),
            )
            ->errors(['email' => 'This e-mail is already registered.'])
            ->submit('Create account'),
        Grid::make('preview-grid')
            ->caption('Users')
            ->column('name')
            ->column('email', 'E-mail')
            ->pageSize(2)
            ->rows([
                ['name' => 'Ada Lovelace', 'email' => 'ada@example.com'],
                ['name' => 'Alan Turing', 'email' => 'alan@example.com'],
                ['name' => 'Grace Hopper', 'email' => 'grace@example.com'],
            ]),
    );