Kotchasan Framework Documentation
UI Components
UI Components
Documentation for other UI components in Kotchasan.
Accordion
\Kotchasan\Accordion creates collapsible sections.
use Kotchasan\Accordion;
$accordion = new Accordion();
$accordion->add('Section 1', 'Content for section 1');
$accordion->add('Section 2', 'Content for section 2');
echo $accordion->render();Grid
\Kotchasan\Grid is for grid layout.
use Kotchasan\Grid;
$grid = new Grid(['cols' => 3]);
$grid->add('<div>Item 1</div>');
$grid->add('<div>Item 2</div>');
$grid->add('<div>Item 3</div>');
echo $grid->render();HtmlTable
\Kotchasan\HtmlTable creates HTML tables.
use Kotchasan\HtmlTable;
$table = new HtmlTable();
$table->setHeaders(['ID', 'Name', 'Email']);
$table->addRow([1, 'John', 'john@example.com']);
$table->addRow([2, 'Jane', 'jane@example.com']);
echo $table->render();Methods
| Method | Description |
|---|---|
setHeaders($headers) |
Set header row |
addRow($row) |
Add data row |
setClass($class) |
Set CSS class |
render() |
Render as HTML |
CKEditor
\Kotchasan\CKEditor for WYSIWYG editor.
use Kotchasan\CKEditor;
$editor = new CKEditor([
'id' => 'content',
'name' => 'content',
'value' => $existingContent
]);
echo $editor->render();DOMParser
\Kotchasan\DOMParser for parsing HTML.
use Kotchasan\DOMParser;
$html = '<div class="content"><p>Hello</p></div>';
$parser = new DOMParser($html);
$content = $parser->querySelector('.content');
$text = $parser->getText();DOMNode
\Kotchasan\DOMNode for managing DOM nodes.
use Kotchasan\DOMNode;
$node = new DOMNode('div');
$node->setAttribute('class', 'container');
$node->appendChild($child);
echo $node->outerHTML();Htmldoc
\Kotchasan\Htmldoc for HTML document generation.
use Kotchasan\Htmldoc;
$doc = new Htmldoc();
$doc->title = 'My Page';
$doc->addMeta('description', 'Page description');
$doc->addScript('app.js');
$doc->addStyle('style.css');
echo $doc->render();