UiRenderer - viames/pair GitHub Wiki
Pair framework: UiRenderer
Pair\Html\UiRenderer is the renderer contract behind Application::uiFramework(...) and UiTheme.
Pair ships three renderers:
Pair\Html\UiRenderers\NativeUiRendererPair\Html\UiRenderers\BootstrapUiRendererPair\Html\UiRenderers\BulmaUiRenderer
Native HTML remains the default.
Register a renderer
use Pair\Html\UiRenderers\NativeUiRenderer;
use Pair\Html\UiTheme;
final class TailwindRenderer extends NativeUiRenderer {
public function name(): string {
return 'tailwind';
}
public function alertClass(string $variant = 'primary'): string {
return 'rounded border p-4';
}
}
UiTheme::registerRenderer(new TailwindRenderer());
Application::getInstance()->uiFramework('tailwind');
Renderers can be registered directly in bootstrap code or by a manual RuntimeExtensionInterface.
What renderers own
Renderers centralize UI-framework-specific helper output:
- control classes
- label classes
- label help tooltip markup
- select wrappers
- alert and badge classes
- alignment helpers
- pagination markup
This keeps Form, FormControl, Pagination, and Utilities::showNoDataAlert() on one stable API while Bootstrap, Bulma, native HTML, and future renderers differ only behind the renderer contract.
Compatibility
Existing calls still work:
$app->uiFramework('bootstrap');
$app->uiFramework('bulma');
$app->uiFramework('native');
UiTheme::isBootstrap(), UiTheme::isBulma(), and UiTheme::isNative() are preserved for compatibility.
See also: Application, Form, FormControl, Pagination, AdapterRegistry.