Celerik\Ui
Assets
final class Celerik\Ui\Assets
Renders the tags for the prebuilt bundle (public/celerik.css and public/celerik.js).
celerik.js is an ES module that loads each component's library from public/chunks/ only when that component is on the page. Module scripts are deferred, so jQuery and Bootstrap (peer dependencies) only need to be included before these tags.
Constants
| Constant | Value |
|---|---|
STYLESHEET | 'celerik.css' |
SCRIPT | 'celerik.js' |
THEMES | ['bootstrap', 'material', 'tailwind'] |
CDN | 'https://cdn.jsdelivr.net/npm/@celerik/ui@%s/public' |
Methods
cdnUrl
static cdnUrl(?string $version = null): stringThe bundle's URL on the jsDelivr CDN, for Assets::tags() when you do not serve the package's public/ folder yourself:
Assets::tags(Assets::cdnUrl()); // the installed version
Assets::tags(Assets::cdnUrl('0.2.0'));Allow https://cdn.jsdelivr.net in script-src and style-src if you use a CSP.
development version (a branch or a path repository).$version: A released version; by default the installed one.- Throws InvalidArgumentException When the version is not a release version.
- Throws LogicException When no version is given and the installed one is a
tags
static tags(string $baseUrl, ?string $nonce = null, string $theme = 'bootstrap', ?string $customTheme = null): string FullCalendar reads to allow the styles it injects at runtime. ThemeBuilder), loaded last. Its base must be $theme.$nonce: CSP nonce. Also printed as <meta name="csp-nonce">, which$theme: "bootstrap" (default), "material" or "tailwind".$customTheme: URL of a stylesheet made with Theme::toCss() (or the
Component
abstract class Celerik\Ui\Component implements Stringable
Base class for every Celerik UI component.
Components render framework-neutral HTML. Client-side behaviour is attached by the JS bundle, which looks for data-celerik="<name>" and reads the JSON stored in data-celerik-options. No inline scripts are emitted, so pages work under a strict CSP.
Methods
__construct
__construct(?string $id = null)make
static make(?string $id = null): staticname
static name(): stringShort name used for data-celerik and the component registry (e.g. "grid").
toArray
toArray(): arrayOptions consumed by the JS wrapper.
render
render(): stringgetId
getId(): stringoptions
options(array $options): staticMerges raw options for the underlying library (DataTables, Chart.js, Parsley...). They are applied last on the client, so they can override any generated setting.
attribute
attribute(string $name, string|int|float|bool|null $value = true): staticaddClass
addClass(string ...$classes): staticComponentRegistry
final class Celerik\Ui\ComponentRegistry
Maps component names to classes. Plugins register their own components here and the matching initializer on the client with Celerik.register(name, fn).
Methods
withDefaults
static withDefaults(): selfregister
register(string $class): selfhas
has(string $name): boolcreate
create(string $name, ?string $id = null): Componentall
all(): array