Contents

System\Classes\UiFactory

Overview

UiFactory creates view-based UI components.

Usage:

<?= UiFactory::button(label: 'Save', primary: true) ?>

<?php UiFactory::card(title: 'Settings')->slot() ?>
    <p>Content</p>
<?php UiFactory::end() ?>

Public Methods

public static ajaxButton()

public static ajaxButton(
    string $label = '',
    string $handler = '',
    string $icon = '',
    bool $primary = '',
    bool $secondary = false,
    array $requestData = false,
    $danger = false,
    $hotkey = '',
    $requestData = [],
    $attributes = null
): System\Classes\ViewComponent|System\Classes\UiFactory\Migrate\AjaxButton 

ajaxButton creates an AJAX button component

public static button()

public static button(
    string $label = '',
    string $href = '',
    string $icon = '',
    bool $primary = '',
    bool $secondary = false,
    $secondary = false,
    $danger = false,
    $hotkey = '',
    $attributes = null
): System\Classes\ViewComponent|System\Classes\UiFactory\Migrate\Button 

button creates a button component

public static callout()

public static callout($body = null): void

callout creates a callout, where the optional body is a string, closure or UI element

public static dropdownButton()

public static dropdownButton(
    string $label = '',
    string $icon = '',
    bool $primary = false,
    bool $secondary = false,
    bool $caret = true,
    $attributes = null
): System\Classes\ViewComponent 

dropdownButton creates a dropdown button component (slot-based)

Usage: <?php Ui::dropdownButton(label: 'Actions', secondary: true)->slot() ?> <?= Ui::dropdownItem(label: 'Edit', handler: 'onEdit') ?> <?php Ui::end() ?>

public static dropdownDivider()

public static dropdownDivider(): System\Classes\ViewComponent 

dropdownDivider creates a dropdown menu separator

public static dropdownItem()

public static dropdownItem(
    string $label = '',
    string $handler = '',
    string $href = '',
    string $icon = '',
    $attributes = null
): System\Classes\ViewComponent 

dropdownItem creates a dropdown menu item component

public static end()

public static end(): void 

end closes the current component and renders it

public static iconButton()

public static iconButton(
    string $label = '',
    string $icon = '',
    string $handler = '',
    bool $danger = false,
    $hotkey = '',
    $attributes = null
): System\Classes\ViewComponent 

iconButton creates an icon-only button component

public static popupButton()

public static popupButton(
    string $label = '',
    string $handler = '',
    string $icon = '',
    bool $primary = '',
    bool $secondary = false,
    array $requestData = false,
    $danger = false,
    $hotkey = '',
    $requestData = [],
    $attributes = null
): System\Classes\ViewComponent|System\Classes\UiFactory\Migrate\PopupButton 

popupButton creates a popup button component

public static searchInput()

public static searchInput(
    string $name = '',
    string $value = null,
    string $placeholder = '',
    bool $handler = '',
    $attributes = null
): System\Classes\ViewComponent 

searchInput creates a search input

public static slot()

public static slot($name): void 

slot switches to a named slot on the current component