Skip to content

API reference ​

Every public class of caelrik/ui, generated from the PHP code and its docblocks.

Caelrik\Ui ​

  • Assets: Renders the tags for the prebuilt bundle (public/caelrik.css and public/caelrik.js).
  • Component: Base class for every Caelrik UI component.
  • ComponentRegistry: Maps component names to classes. Plugins register their own components here and the matching initializer on the client with Caelrik.register(name, fn).

Caelrik\Ui\Adapters\Laravel ​

  • CaelrikServiceProvider: Auto-discovered through extra.laravel.providers in composer.json.
  • EloquentDataSource: Data source for an Eloquent or query builder, e.g. new EloquentDataSource(User::query()).
  • EloquentEventSource: Event source for an Eloquent or query builder, e.g. new EloquentEventSource(Meeting::query(), ['start' => 'starts_at', 'end' => 'ends_at']).

Caelrik\Ui\Adapters\Laravel\View ​

  • AssetsComponent: <x-caelrik-assets /> or <x-caelrik-assets custom-theme="/css/acme.css" /> — load jQuery and Bootstrap before it. theme is deprecated: "bootstrap" is the only look since 0.2.0.
  • CaelrikComponent: <x-caelrik :component="$grid" />

Caelrik\Ui\Adapters\Symfony ​

  • CaelrikTwigExtension: {{ caelrik_assets() }} or {{ caelrik_assets(customTheme: '/css/acme.css') }} — load jQuery and Bootstrap before it. {{ caelrik(grid) }} — renders any Caelrik component.
  • CaelrikUiBundle: Register in config/bundles.php: php Caelrik\Ui\Adapters\Symfony\CaelrikUiBundle::class => ['all' => true],
  • DoctrineDataSource: Data source for a Doctrine ORM query builder, e.g. new DoctrineDataSource($repository->createQueryBuilder('u')->select('u.id, u.name, u.email')).
  • DoctrineEventSource: Event source for a Doctrine ORM query builder, e.g. new DoctrineEventSource($repository->createQueryBuilder('m'), ['start' => 'startsAt', 'end' => 'endsAt']).

Caelrik\Ui\Components ​

  • Accordion: Panels that open and close under their headings (the WAI-ARIA accordion; the Telerik PanelBar): a FAQ, a settings page in sections, filters in a sidebar.
  • Action: A button that does something: opens a page, or sends a request after an optional confirmation. Use it on its own (a page, a toolbar) or in a Grid's rows (Grid::actions()).
  • AdminLayout: The frame of an admin screen: a skip link, an app bar (brand, your items, the user menu), a sidebar with the navigation, and the main content with its breadcrumb and title.
  • Avatar: A person's picture, or their initials on a color picked from their name (AA contrast). It is an image named after the person ("Ada Lovelace, online"), or decorative() next to their written name. A status is a dot whose shape, not only its color, tells it apart. Plain HTML, no JavaScript.
  • Badge: A badge: a short status or count, in a Bootstrap color with an AA contrast (text-bg-*). A hidden text completes it for screen readers: "3" reads "3 unread messages". Plain HTML, no JavaScript.
  • Barcode: A one-dimensional barcode drawn by PHP as an SVG (no JavaScript, no inline styles), with its value written under it as text. - code128 (default): any ASCII text; runs of digits are packed two by two. - ean13: 12 digits (the check digit is added) or 13 (the check digit is checked), as on products and books (ISBN). - The drawing is an image named "Barcode: {label}" (the label, or else the value). Dark bars on a light tile, in dark mode and in forced colors too: scanners need them.
  • Breadcrumb: Where the page sits: Home / Members / Ada Lovelace. A navigation landmark with an ordered list; the last item is the current page (aria-current="page") and is not a link.
  • Card: A card: a title, text, a picture, content, actions and a footer (Bootstrap's card). With link(), the title is a link whose click area covers the card, while its actions keep working; the card stays one link in the reading order, not a big one.
  • Carousel: A carousel (the WAI-ARIA carousel pattern): slides shown one at a time, with Previous and Next buttons and a button per slide. - Each slide is a group named "2 of 5", or by its label; changes made by the user are announced (the slides are a polite live region, silent while they rotate). - autoplay(): a Stop/Start button comes first; rotation pauses while the pointer or focus is in the carousel, stops once the user picks a slide, and does not start for reduced motion (WCAG 2.2.2). - Touch screens swipe. Without JavaScript, the slides are shown one under the other.
  • Chart: Chart backed by Chart.js.
  • Chip: A chip: a compact label, plain, removable or selectable. - removable(): a Remove button ("Remove PHP") takes the chip and its hidden field away (JavaScript; without it the button is hidden), moves focus to the next chip's button, says so, and fires a cancelable caelrik:remove. - checkbox(): a filter chip, a real checkbox posted with its form, with or without JavaScript.
  • ContextMenu: A menu of actions for an element, opened by a right click, Shift+F10 or the Menu key on it: the files of a list, a grid's rows, the cards of a page.
  • Diagram: A flowchart drawn by PHP as an SVG (no JavaScript, no inline styles), and written as text. - Steps are laid out in ranks, downwards or to the right; an arrow that goes back (a loop) is drawn around the side. Each rank is ordered to cross fewer arrows. - The SVG is an image named by the caption; under it, "Steps as text" lists every step and where each arrow leads ("Yes: Account created"), with links between the steps.
  • FileManager: File manager (elFinder). The connector endpoint runs FileManagerConnector::run().
  • Form: Bootstrap form with client-side validation (Parsley.js) and input masks (Inputmask).
  • Gantt: A Gantt chart: a table of tasks (name, start, end, progress, what each depends on) whose last column is the timeline. Every row draws its own bar as an SVG sized by attributes (no inline styles), so bars always line up with their rows; the table says everything the bars show. - Milestones are diamonds; "Milestone" is written in their progress cell. - The timeline has a scale (day, week or month), a line for today and, with JavaScript, arrows from each task to the tasks that depend on it. It scrolls sideways, task names stay.
  • Gauge: A gauge: a value on a scale, as a semicircle (default) or a bar, drawn by PHP as an SVG (no JavaScript, no inline styles). It is a meter (role="meter") named by its label, whose value text gives the value, its band and the target ("72%, High, target 90%"). - band(): colored ranges of the scale; the value takes its band's color, and the band's name is written next to the value, so the color is never the only sign. - target(): a mark across the scale.
  • Grid: Data grid backed by DataTables.
  • HasMenuItems: The items of a menu (MenuButton, SplitButton): links, actions and dividers. PHP writes a plain list that works without JavaScript; menu.js makes it an ARIA menu.
  • ListView: A list of items, one per row, with a pager: articles, people, products, notifications.
  • Loader: A loading indicator: Bootstrap's spinner in a status region that says what is loading ("Loading orders"), hidden or shown. The spinner slows down for reduced motion. Plain HTML, no JavaScript.
  • Map: A map (Leaflet) with markers, and the same places written as a list under it. - The list is the text alternative: each place's name, description and link, and a "Show on map" button that brings its marker into view, opens its popup and moves focus to it. - The map is a named region: arrow keys move it, plus and minus zoom (said to screen readers); markers are buttons named after their place. Wheel zoom is off unless scrollZoom(), so the page scrolls past the map; animations stop for reduced motion. - Tiles from OpenStreetMap by default; tiles() sets another server and its attribution.
  • MediaPlayer: A video or audio player: a native <video> or <audio> element (it plays without JavaScript, with the browser's controls), which Plyr gives the same accessible controls in every browser: play, a seek bar, the time, volume, captions, speed, picture in picture and full screen, all with the keyboard and named for screen readers. - captions() and descriptions() add text tracks (WebVTT); transcript() writes the words under the player, each with a time that plays the media from there (WCAG 1.2). - The player is a figure named by its label.
  • MenuButton: A button that opens a menu of links and actions (the WAI-ARIA menu button; the Telerik DropDownButton): Export ▾ → CSV, Excel, Print.
  • Modal: Bootstrap modal dialog. Bootstrap's JS (the page's bootstrap.bundle) handles opening, focus trapping, Escape and returning focus to the trigger.
  • Navigation: An application's navigation: links, and groups of links that open and close. The sidebar of an AdminLayout (the Telerik Drawer), or a navigation anywhere.
  • Notification: Toast notifications (Notyf), typically from flash messages after a redirect.
  • OrgChart: An organization chart: people in nested lists, drawn as a tree by CSS (connectors are borders, no inline styles). Screen readers hear lists and their levels; it needs no JavaScript. In a narrow container it becomes an indented list; otherwise it scrolls sideways. - collapsible(): each manager gets a button that shows or hides their team ("Ada Lovelace's team, 3 people"), with aria-expanded; expandLevels() sets how deep it opens.
  • PdfViewer: A PDF viewer (PDF.js, loaded only by pages that use it): the pages drawn in a scrolling area, with a text layer that screen readers read and the browser's search finds, a toolbar (previous and next page, a page number, zoom) and a download link, always there. - The viewer is a region named by its label; the download link is the way to open the document in another reader (a screen reader's own PDF support, a tagged PDF), and the fallback without JavaScript. - No inline styles: the pages are sized by the CSSOM.
  • Popover: A popover: a button that shows a small panel of content next to it (help, details, a few links). It is a native disclosure (<details>), so it opens without JavaScript; with it, Escape closes it and returns focus to its button, and it closes when focus or a click goes elsewhere. The panel follows the button in the reading and tab order.
  • Progress: Progress: a bar (a native <progress>, sized without inline styles) or a circle (an SVG progressbar), named by its label, its value shown or not. Without a value it is indeterminate: something is going on, how much is not known. Plain HTML, no JavaScript; to move it, set the bar's value, or the circle's aria-valuenow and its arc.
  • QrCode: A QR code drawn by PHP as an SVG (no JavaScript, no inline styles), with its content written under it, so that nobody needs a phone to read it. - The drawing is an image named "QR code: {label}" (the label, or else the value). - The value is written in the caption, as a link when it is a web address; hideValue() keeps it out of the caption (a long token), and the label then says what the code is for. - Dark modules on a light tile, in dark mode and in forced colors too: scanners need them.
  • RecordView: A read-only layout of a record's fields, by sections (Filament's infolists): each section a heading and a description list of labels and values, in one to four columns (one on small screens). The record is an array, an ArrayAccess (an Eloquent model) or an object; fields use dot notation ("company.name").
  • Scheduler: Scheduler / calendar backed by FullCalendar (MIT plugins only).
  • Skeleton: A skeleton: grey shapes standing for content that is loading (Bootstrap's placeholders). Screen readers hear its status ("Loading profile"), not the shapes; the glow stops for reduced motion. Plain HTML, no JavaScript.
  • Sparkline: A sparkline: a small chart drawn by PHP as an SVG (no JavaScript, no inline styles), the size of a word, for text, table cells and record views. It is an image named after its values' range ("Revenue, last 7 values: from 8 to 16, lowest 8, highest 16."), or decorative() when the values are written next to it.
  • SplitButton: A main action with a menu of others beside it: Save | ▾ Save as draft, Save and close. The main action is any Action; the arrow is a menu button named "More options".
  • Splitter: Panes side by side (or one above the other) that the user resizes: a file list and a preview, a form and its help (the WAI-ARIA window splitter).
  • Stat: A stat tile: a label, a value, a trend against a previous period and a sparkline.
  • Stats: A row of stat tiles: a list, named by its label, in 1 to 6 columns (two on small screens, one on phones).
  • Tabs: Bootstrap tabs following the WAI-ARIA tabs pattern (tablist, tab, tabpanel). Bootstrap's JS switches panels and handles arrow-key navigation.
  • TaskBoard: A task board (Kanban): columns of cards that move from one column to another.
  • ThemeBuilder: Edit a theme's tokens with a live preview of real components and a WCAG contrast report, then export the stylesheet (Theme::toCss()) or the theme JSON.
  • TileLayout: A dashboard of tiles on a grid of columns: each tile a titled region, as wide and as high as its spans. The user can rearrange them (reorderable(), resizable()): - each tile's Arrange button shows its tools (Move earlier, Move later, Narrower, Wider, Shorter, Taller), buttons that work with one click or the keyboard (WCAG 2.5.7); - on that button, the arrow keys move the tile, and with Shift resize it; - the button can be dragged to another tile's place, and the tile's corner to a new size. Tiles move in the page, so the reading and focus order follow what is seen. Without JavaScript the tiles are shown as laid out by PHP; on small screens, in one column.
  • Timeline: A timeline: an ordered list of events, each with a title, a time (a <time> element for a date), a description, a colored marker and an optional link. The current step is marked with aria-current="step" and a ring. On wide screens, alternate() puts the events on both sides of the line. Plain HTML, no JavaScript.
  • Toolbar: A row of controls: actions, menu buttons, split buttons, your own buttons and fields.
  • Tooltip: A tooltip: a short text describing a control, shown while it is hovered or focused (the WAI-ARIA tooltip pattern). It meets WCAG 1.4.13: the pointer can move onto it, Escape hides it without moving focus, and it stays until the pointer or focus leaves. The control describes itself with it (aria-describedby) and keeps its own name: a tooltip is extra, never the only name of an icon button. It needs JavaScript; without it, nothing is shown.
  • TreeList: A table whose rows nest like a tree: tasks and subtasks, an organisation, a budget with its lines, folders with their sizes.
  • TreeView: A tree of nodes: folders, categories, an outline, a site's pages.
  • UserMenu: The signed-in user's menu, in an app bar: their name and picture (or initials), and links such as Profile, plus actions such as Sign out (an Action::request()).

Caelrik\Ui\Components\Form ​

  • Field: A Bootstrap form control with validation rules.
  • Grid: Lays out the fields and sections of a form or section in Bootstrap grid columns.
  • Repeater: A group of fields the user repeats: order lines, addresses, contacts. Each row submits as name[key][field]; the user adds, removes and (with reorderable()) moves rows.
  • Section: Groups the fields of a form: a section (a card with a heading, optionally collapsible) or a fieldset (a border and a legend, for controls that belong together, such as an address). Both can lay their fields out in columns and hold other sections.
  • Wizard: Renders a form's sections as the steps of a wizard (Form::wizard()): a step indicator, one step at a time, and Back, Next and submit buttons. form.js checks each step's fields before the next one; the whole form is submitted at the end.

Caelrik\Ui\Components\Grid ​

  • Column
  • Editor: How a grid cell is edited in place (Column::editable()): a text, a number, a choice from a list, yes or no, or a date. The browser checks the value before sending it, and Grid::cellEdit() checks it again on the server with the same rules.
  • Filter: A column filter of a Grid, shown in the filter bar above the table:

Caelrik\Ui\Components\RecordView ​

  • Entry: One field of a record view: its label and its value, shown as text, a link, a date, a number, a yes or no, a badge, a list or a picture.

Caelrik\Ui\Data ​

  • Aggregate: Column totals: the functions a Grid column can total with, how rows of a PHP array are totalled, and how a total is written. resources/js/grid-summary.js does the same in the browser, so both write a total alike.
  • ArrayDataSource: In-memory data source for plain PHP arrays (framework-free apps, fixtures, tests).
  • ArrayEventSource: In-memory event source for plain PHP arrays, fixtures and tests.
  • CardMove: A checked move of a task board's card (TaskBoard::cardMove()): the column it goes to, and its position there, from 0 at the top; null puts it last (a move sent without JavaScript).
  • CellEdit: A checked change to one grid cell (Grid::cellEdit()): the column's field and its new value, typed as its editor reads it.
  • DataRequest: Normalized paging, sorting, search and filter parameters.
  • DataResult: One page of rows plus the metadata every Caelrik endpoint returns:
  • DataSourceInterface: A source of rows for data-bound components (Grid today, Scheduler and others later).
  • DateRange: The visible date range FullCalendar asks events for: ?start=...&end=... (end exclusive).
  • Event: A calendar event, validated on construction and serialized in FullCalendar's format.
  • EventResult: Events for one date range, in the standard Caelrik envelope:
  • EventSourceInterface: A source of calendar events for the Scheduler.
  • InvalidCardMove: A move a task board refuses (TaskBoard::cardMove(), or your own rules, e.g. a full column): answer it with a 422 and toArray(); the card goes back and the message is read.
  • InvalidCellEdit: A value a grid cell cannot take (Grid::cellEdit()): answer it with a 422 and toArray(), and the grid shows the message in the cell.

Caelrik\Ui\FileManager ​

Caelrik\Ui\Support ​

  • Arr: Dot-notation helpers for row arrays (user.name reads $row['user']['name']).
  • Dates: Strict ISO 8601 date parsing for values coming from requests and databases.
  • EditorHtml: Server-side cleaning of rich text editor output (Field::editor()).
  • Html: Minimal, escaping-by-default HTML builder used by every component.
  • QrMatrix: A QR code encoder (ISO/IEC 18004, model 2, versions 1 to 40): the text is encoded as one segment (numeric, alphanumeric or UTF-8 bytes, whichever is shortest) in the smallest version that holds it, with Reed-Solomon error correction and the mask of the lowest penalty. It follows the structure of Project Nayuki's QR Code generator (MIT).
  • RawHtml: Trusted HTML, inserted as-is where components accept content (Modal, Tabs). Create it with Html::raw() only for markup you control or have sanitized.
  • Url: URLs from data, made safe for href and src.

Caelrik\Ui\Theme ​

  • Console: The caelrik-theme command: build a theme stylesheet from theme.json, check its contrast, or start a theme from a preset.
  • Contrast: WCAG 2.x contrast checks for theme palettes. The pairs come from theme/contrast.json, which the ThemeBuilder and the tests use too.
  • ContrastResult: The contrast of one color pair of a theme, in one mode.
  • Stylesheet: Writes a theme's stylesheet: custom properties for the light and dark palettes and the shape tokens, loaded after caelrik.css.
  • Theme: A Caelrik theme: design tokens on top of Bootstrap (theme/theme.schema.json).

Caelrik\Ui\Upload ​

  • StoredFile: A validated file in its final location.
  • UploadException: A rejected upload. The message is safe to show to the user.
  • UploadHandler: Validates and stores uploads.
  • UploadRules: Which files an upload field accepts: MIME types with their allowed extensions, a size limit and a file count. The same rules drive the field (accept attribute, client-side checks, help text) and the server (UploadHandler).
  • UploadedFile: A file received over HTTP, before validation.

Released under the MIT License.