reblocks-ui2 - A pack of UI components for Reblocks web-framework.

REBLOCKS-UI2 ASDF System Details

Installation

You can install this library from Quicklisp, but you want to receive updates quickly, then install it from Ultralisp.org:

(ql-dist:install-dist "http://dist.ultralisp.org/"
                      :prompt nil)
(ql:quickload :reblocks-ui2)

Usage

All widgets are theme-aware: a widget knows nothing about the markup and is rendered by the current theme via the reblocks-ui2/widget:render generic function which receives the widget and the theme. To style the widgets with Tailwind, load the reblocks-ui2-tailwind system and make the Tailwind theme current before starting the server:

(ql:quickload :reblocks-ui2-tailwind)
(setf (reblocks-ui2/themes/api:current-theme)
      (reblocks-ui2/themes/tailwind:make-tailwind-theme))

Particular widgets are described in the sections below — Date Input, Charts, Confirmation Form and CRUD Table — and the full API reference is in the API section.

Date Input

function
&key (widget-class 'input-widget) name value (format :iso) (required t) placeholder (view :normal) (size :m) disabled error

Returns a native HTML date input.

This is a thin constructor over the usual text input with :TYPE "date" and a valid-date validator attached.

VALUE should be a "YYYY-MM-DD" string, because this is the format browsers use for inputs with type="date".

FORMAT is passed to valid-date and only controls how the submitted data is parsed on the server. By default, the date is required; pass :REQUIRED NIL to allow empty values, in which case the validator returns NIL.

Returns a validator converting a date string into a local-time timestamp.

Two formats are supported:

  • :ISO (default) expects "YYYY-MM-DD" strings. This is a native format of the HTML inputs with type="date".

  • :DDMMYYYY expects "DD.MM.YYYY" strings.

When VALUE is empty and REQUIRED is NIL, the resulting validator returns NIL. An empty VALUE with the default REQUIRED = T signals a validation-error (1 2), as well as a VALUE which does not match the format or denotes a non-existent date like 2025-02-31.

Formats TIMESTAMP as a date string.

Supported formats are the same as for valid-date:

  • :ISO (default) returns "YYYY-MM-DD" strings.

  • :DDMMYYYY returns "DD.MM.YYYY" strings.

A NIL TIMESTAMP is formatted as an empty string, so that the result can be used as an input widget's value.

Here is how a form with a native date input can be created:

(reblocks-ui2/form:form
 (reblocks-ui2/containers/column:column
  (reblocks-ui2/inputs/date-input:date-input
   :name "birthday"
   :value "2025-11-07"
   :required nil))
 :on-submit
 (lambda (form &key birthday)
   ;; BIRTHDAY is a local-time timestamp here, or NIL because
   ;; the date is optional in this example.
   (declare (ignore form birthday))))

The widget is a thin wrapper around a text input with type="date" and attaches a reblocks-ui2/form/validators:valid-date validator. The value is a "YYYY-MM-DD" string, native for the browser. Pass :format :ddmmyyyy to parse "DD.MM.YYYY" strings instead, and use reblocks-ui2/form/validators:format-date to convert a timestamp back into a string suitable for the widget's value.

Charts

function
data &rest restargs &key title column-names height background-color extra-options pie-hole is3d slice-colors (widget-class 'pie-chart)

Returns a pie chart widget rendered by Google Charts.

DATA is either a list of rows of the form (LABEL NUMBER-VALUE), or a function of zero arguments returning such a list. The function is called on each render to fetch fresh data.

PIE-HOLE is a number between 0 and 1, cut out from the center (0 for a usual pie chart, 0.4 for a donut).

IS3D turns on the pseudo-3D effect.

SLICE-COLORS is a list of CSS colors applied to the slices in order.

EXTRA-OPTIONS is a raw JavaScript string, inserted into the Google Charts options object before the closing bracket.

WIDGET-CLASS may be a subclass of pie-chart (1 2) to instantiate instead.

A pie chart widget rendered by Google Charts.

The pie-chart (1 2) symbol names both this class and a constructor function, following the donor widgets from the lct25 project.

function
data &rest restargs &key title column-names height background-color extra-options x-title y-title v-axis-min-zero (widget-class 'column-chart)

Returns a column chart widget rendered by Google Charts.

DATA is either a list of rows of the form (LABEL NUMBER-VALUE), or a function of zero arguments returning such a list. The function is called on each render to fetch fresh data.

X-TITLE and Y-TITLE add titles to the horizontal and vertical axes.

V-AXIS-MIN-ZERO (the default) makes the vertical axis start at zero.

EXTRA-OPTIONS is a raw JavaScript string, inserted into the Google Charts options object before the closing bracket.

WIDGET-CLASS may be a subclass of column-chart (1 2) to instantiate instead.

A column chart widget rendered by Google Charts.

The column-chart (1 2) symbol names both this class and a constructor function, following the donor widgets from the lct25 project.

Base class for chart widgets rendered by Google Charts.

Subclasses such as reblocks-ui2/charts/pie-chart:pie-chart (1 2) and reblocks-ui2/charts/column-chart:column-chart (1 2) define chart type specific options, theming methods do the rendering.

Charts are rendered by Google Charts:

(reblocks-ui2/charts/pie-chart:pie-chart
 '(("Alpha" 10)
   ("Beta" 25))
 :title "Tasks by mission"
 :column-names '("Mission" "Tasks"))

(reblocks-ui2/charts/column-chart:column-chart
 '(("2026-W1" 3)
   ("2026-W2" 7))
 :title "Users by week"
 :column-names '("Week" "Users")
 :x-title "Week"
 :y-title "Users")

DATA is either a list of (LABEL NUMBER) rows, or a function of zero arguments returning such a list. The function is called on each render, so charts always show fresh data. The Google Charts loader script is added as a widget dependency and requires no manual wiring.

Confirmation Form

function
CONTENT &KEY (CONFIRM-BUTTON-TITLE "Confirm") (CANCEL-BUTTON-TITLE "Cancel") (CONFIRM-VALUE "submit") (CANCEL-VALUE "cancel") ON-CONFIRM WIDGET-CLASS

Returns a form widget asking the user to confirm an action.

CONTENT is a question to show to the user. It might be a string or any other widget and is processed by reblocks/widget:create-widget-from, like the content of the usual form.

The form contains two submit buttons sharing the name "button". The Confirm button submits CONFIRM-VALUE and the Cancel button submits CANCEL-VALUE. Both titles and values are customizable.

The Confirm button is the first submit button in the HTML. This way pressing Enter in the form submits it as if the Confirm button was pressed, because browsers use the first submit button for the implicit submission.

ON-CONFIRM, if given, is called with the form widget as the only argument, but only when the form was submitted with the button whose value is string-equal to CONFIRM-VALUE. Submission of the Cancel button does nothing. No persistence happens inside the widget, and no modal windows are hidden: to close a modal showing this form, call reblocks-ui2/modal:modal-hide from the ON-CONFIRM callback.

Use reblocks-ui2/form/confirm:confirm when an action has to be confirmed by the user. It returns a usual form with two submit buttons: Confirm and Cancel. The on-confirm callback is called with the form widget and only when the Confirm button (or Enter, because the Confirm button is the first submit button in the HTML) was used:

(reblocks-ui2/form/confirm:confirm
 "Delete this mission?"
 :confirm-button-title "Yes, delete"
 :on-confirm
 (lambda (form)
   (declare (ignore form))
   ;; Perform the action here.
   ))

The widget does not close modal windows by itself. When the form is shown inside a reblocks-ui2/modal:modal, hide the modal from the callback:

(let ((modal (reblocks-ui2/modal:modal
              (reblocks-ui2/form/confirm:confirm
               "Delete this mission?"
               :on-confirm
               (lambda (form)
                 (declare (ignore form))
                 (reblocks-ui2/modal:modal-hide modal))))))
  ;; Show the modal from some button's ON-CLICK callback:
  (reblocks-ui2/buttons/button:button
   "Delete mission"
   :on-click (lambda (button)
               (declare (ignore button))
               (reblocks-ui2/modal:modal-show modal))))

CRUD Table

function
columns data-getter &rest restargs &key add-form-maker edit-form-maker on-delete delete-question add-button-title edit-button-title delete-button-title edit-header delete-header add-header row-class widget-class

Returns a table widget with search and Add/Edit/Delete actions.

COLUMNS should not include an actions column: it is added automatically as the last column when at least one of ADD-FORM-MAKER, EDIT-FORM-MAKER or ON-DELETE is given.

DATA-GETTER is given as is to reblocks-ui2/tables/search:make-search-widget and should return a list of objects to show.

  • ADD-FORM-MAKER is called as (FUNCALL ADD-FORM-MAKER CRUD-WIDGET modal (1 2)) and should return a form widget.

  • EDIT-FORM-MAKER is called as (FUNCALL EDIT-FORM-MAKER modal (1 2) OBJECT) and should return a form widget.

  • ON-DELETE is called as (FUNCALL ON-DELETE OBJECT) after the user has confirmed the deletion.

When the library opens a form in the modal, it also subscribes to the form's :SUBMIT event, to update the table after a successful submission: the whole table is updated after the add form was submitted, and only the row's cells are recalculated after the edit form was submitted.

A search table with Add, Edit and Delete actions.

This widget knows nothing about the persistence: forms are created by ADD-FORM-MAKER and EDIT-FORM-MAKER callbacks, and the deletion is performed by the ON-DELETE callback. All of them are optional: only the corresponding buttons are rendered for the given callbacks.

A whole CRUD table can be created with a single reblocks-ui2/tables/crud:make-crud-table call. It renders a search table and adds an actions column with Edit and Delete buttons, plus an Add button above the table. Forms are created by the application and shown in a modal:

(reblocks-ui2/tables/crud:make-crud-table
 (list (reblocks-ui2/tables/table:column "Title"
                                         :getter #'task-title))
 ;; DATA-GETTER is given to the search widget and
 ;; returns the list of objects to show:
 (lambda (&rest args)
   (declare (ignore args))
   (copy-list *tasks*))
 :add-form-maker (lambda (crud-widget modal)
                   (reblocks-ui2/form:form
                    (reblocks-ui2/inputs/text-input:input
                     :name "title")
                    :on-submit (lambda (form &key button title)
                                 (declare (ignore form))
                                 (when (string-equal button "submit")
                                   (push (make-task title)
                                         *tasks*))
                                 (reblocks-ui2/modal:modal-hide modal))))
 :edit-form-maker (lambda (modal task)
                    ;; Should return a form editing the TASK.
                    ...)
 :on-delete (lambda (task)
              (setf *tasks*
                    (remove task *tasks*)))
 :delete-question (lambda (task)
                    (format nil "Delete this task: ~A?"
                            (task-title task))))

Each button is rendered only when the corresponding callback is given; without any callback the table has no actions column at all. The widget knows nothing about the persistence: saving objects inside the forms and deleting them in ON-DELETE is up to the application. After the add form is submitted, the whole table is updated; after the edit form is submitted, only the edited row's cells are recalculated. DELETE-QUESTION may also be a plain string.

API

REBLOCKS-UI2/BUTTONS/BUTTON

Classes

BUTTON

Accessors

If not given, then type will be "button" for a button having on-click callback or "submit" otherwise.

Functions

function
CONTENT &KEY NAME VALUE TYPE (WIDGET-CLASS 'BUTTON) ON-CLICK (CLASS "button") DISABLED STYLE (VIEW :NORMAL) (SIZE :L) (PIN :ROUND) (WIDTH :MIN) HEIGHT

REBLOCKS-UI2/BUTTONS/VIEW

Classes

ACTION
BUTTON-VIEW
NORMAL-DISABLED
NORMAL
OUTLINED-ACTION
OUTLINED-DANGER
OUTLINED-INFO
OUTLINED-SUCCESS
OUTLINED-UTILITY
OUTLINED-WARNING
OUTLINED
RAISED-DISABLED
RAISED

Generics

Returns an alternative view for a button in disabled state.

Functions

REBLOCKS-UI2/CARD

Classes

CARD-WIDGET

Readers

Functions

function
CONTENT &KEY (VIEW :OUTLINED) (WIDTH "full") (HEIGHT '(120)) (PADDING :L) (MARGIN '(NIL NIL)) (HORIZONTAL-ALIGN :CENTER) (VERTICAL-ALIGN :CENTER) ON-CLICK (WIDGET-CLASS 'CARD-WIDGET)

REBLOCKS-UI2/CHARTS/CHART

Classes

CHART-WIDGET

Base class for chart widgets rendered by Google Charts.

Subclasses such as reblocks-ui2/charts/pie-chart:pie-chart (1 2) and reblocks-ui2/charts/column-chart:column-chart (1 2) define chart type specific options, theming methods do the rendering.

Readers

CSS color of the area around the chart.

reader
(:COLUMN-NAMES = '("Label" "Value"))

Names of the two DataTable columns, as strings.

Chart rows, each of the form (LABEL NUMBER-VALUE).

Alternatively, this may be a function of zero arguments. It is called on each render, so that charts always show fresh data.

Raw JavaScript, inserted into the Google Charts options object before the closing bracket. Use it for options which are not covered by typed slots, like "legend: {position: 'none'}".

Chart height in pixels.

A chart title rendered at the top of the chart by Google Charts.

REBLOCKS-UI2/CHARTS/COLUMN-CHART

Classes

COLUMN-CHART

A column chart widget rendered by Google Charts.

The column-chart (1 2) symbol names both this class and a constructor function, following the donor widgets from the lct25 project.

Readers

When true (the default), the vertical axis starts at zero, like vAxis.minValue = 0 in Google Charts.

A title for the horizontal axis. When nil, the axis has no title.

A title for the vertical axis. When nil, the axis has no title.

Functions

function
data &rest restargs &key title column-names height background-color extra-options x-title y-title v-axis-min-zero (widget-class 'column-chart)

Returns a column chart widget rendered by Google Charts.

DATA is either a list of rows of the form (LABEL NUMBER-VALUE), or a function of zero arguments returning such a list. The function is called on each render to fetch fresh data.

X-TITLE and Y-TITLE add titles to the horizontal and vertical axes.

V-AXIS-MIN-ZERO (the default) makes the vertical axis start at zero.

EXTRA-OPTIONS is a raw JavaScript string, inserted into the Google Charts options object before the closing bracket.

WIDGET-CLASS may be a subclass of column-chart (1 2) to instantiate instead.

REBLOCKS-UI2/CHARTS/PIE-CHART

Classes

PIE-CHART

A pie chart widget rendered by Google Charts.

The pie-chart (1 2) symbol names both this class and a constructor function, following the donor widgets from the lct25 project.

Readers

When true, the chart is rendered with pseudo-3D effect.

A number between 0 and 1, describing what fraction of the radius to cut out from the center. 0 gives a usual pie chart, 0.4 gives a donut chart.

A list of CSS colors, applied to the slices in order. When nil, Google Charts default colors are used.

Functions

function
data &rest restargs &key title column-names height background-color extra-options pie-hole is3d slice-colors (widget-class 'pie-chart)

Returns a pie chart widget rendered by Google Charts.

DATA is either a list of rows of the form (LABEL NUMBER-VALUE), or a function of zero arguments returning such a list. The function is called on each render to fetch fresh data.

PIE-HOLE is a number between 0 and 1, cut out from the center (0 for a usual pie chart, 0.4 for a donut).

IS3D turns on the pseudo-3D effect.

SLICE-COLORS is a list of CSS colors applied to the slices in order.

EXTRA-OPTIONS is a raw JavaScript string, inserted into the Google Charts options object before the closing bracket.

WIDGET-CLASS may be a subclass of pie-chart (1 2) to instantiate instead.

REBLOCKS-UI2/CONTAINERS/COLUMN

Classes

COLUMN-WIDGET

Functions

REBLOCKS-UI2/CONTAINERS/CONTAINER

Classes

CONTAINER-WIDGET

Accessors

Readers

Generics

Functions

function
default-widget-class &rest subwidgets-and-options

REBLOCKS-UI2/CONTAINERS/CONTROLS-ROW

Classes

CONTROLS-ROW-WIDGET

Macros

REBLOCKS-UI2/CONTAINERS/ROW

Classes

ROW-WIDGET

Functions

function
subwidgets &key (gap \*default-gap\*) on-click
function
&rest subwidgets-and-options

REBLOCKS-UI2/CONTAINERS/STACK

Classes

STACK-WIDGET

Shows only the top child from the stack. Provides methods to push and pop widgets.

Readers

Generics

Functions

Removes current (top) widget from the stack and display the next widget.

Adds a new widget ontop of the current.

Makes a stack widget with given subwidgets.

Only first widget in the list will be visible.

REBLOCKS-UI2/CONTAINERS/TABS

Classes

TABS-CONTROL

Accessors

Readers

TABS-WIDGET

Readers

Functions

function
titles subwidgets &key (idx 0) (selector-class 'tabs-control) (class 'tabs-widget) (size :l)

Types

REBLOCKS-UI2/EDITABLE

Generics

Creates a widget which can be used to edit a given value. Every time when the widget loose focus, it will call CALLBACK argument with a new value.

REBLOCKS-UI2/EVENTS

Classes

EVENT-EMITTING-WIDGET

REBLOCKS-UI2/FORM

Classes

FORM-WIDGET

Readers

reader
(= (make-hash-table :test 'equal))

Internal structure holding references to all form inputs having a name attribute.

Functions

function
content &key (widget-class 'form-widget) on-submit

REBLOCKS-UI2/FORM/CONFIRM

Functions

function
CONTENT &KEY (CONFIRM-BUTTON-TITLE "Confirm") (CANCEL-BUTTON-TITLE "Cancel") (CONFIRM-VALUE "submit") (CANCEL-VALUE "cancel") ON-CONFIRM WIDGET-CLASS

Returns a form widget asking the user to confirm an action.

CONTENT is a question to show to the user. It might be a string or any other widget and is processed by reblocks/widget:create-widget-from, like the content of the usual form.

The form contains two submit buttons sharing the name "button". The Confirm button submits CONFIRM-VALUE and the Cancel button submits CANCEL-VALUE. Both titles and values are customizable.

The Confirm button is the first submit button in the HTML. This way pressing Enter in the form submits it as if the Confirm button was pressed, because browsers use the first submit button for the implicit submission.

ON-CONFIRM, if given, is called with the form widget as the only argument, but only when the form was submitted with the button whose value is string-equal to CONFIRM-VALUE. Submission of the Cancel button does nothing. No persistence happens inside the widget, and no modal windows are hidden: to close a modal showing this form, call reblocks-ui2/modal:modal-hide from the ON-CONFIRM callback.

REBLOCKS-UI2/FORM/VALIDATION

Classes

FIELD-VALIDATION-ERROR

Readers

FORM-VALIDATION-ERROR

Readers

VALIDATION-ERROR

Readers

Generics

Accepts a form or input widget and a plist of all data sent from the browser.

Should return a plist of validated data. Also, it might change the state of the widgets, for example, to set an error message saying that entered value is invalid. In the case when data is invalid, function should signal validation-error (1 2).

Functions

REBLOCKS-UI2/FORM/VALIDATORS

Functions

Combines a multiple validators into a chain where every subsequent validator validates output of the previous one.

Formats TIMESTAMP as a date string.

Supported formats are the same as for valid-date:

  • :ISO (default) returns "YYYY-MM-DD" strings.

  • :DDMMYYYY returns "DD.MM.YYYY" strings.

A NIL TIMESTAMP is formatted as an empty string, so that the result can be used as an input widget's value.

Returns a validator converting a date string into a local-time timestamp.

Two formats are supported:

  • :ISO (default) expects "YYYY-MM-DD" strings. This is a native format of the HTML inputs with type="date".

  • :DDMMYYYY expects "DD.MM.YYYY" strings.

When VALUE is empty and REQUIRED is NIL, the resulting validator returns NIL. An empty VALUE with the default REQUIRED = T signals a validation-error (1 2), as well as a VALUE which does not match the format or denotes a non-existent date like 2025-02-31.

Returns a validator converting a string into an integer.

MIN and MAX, when given, are checked against the parsed number.

When ALLOW-EMPTY is T, an empty string or NIL (for example, produced by a preceding validator in an all chain) returns NIL, and MIN and MAX are not applied to such a value. With the default ALLOW-EMPTY = NIL an empty value signals a validation-error (1 2), like any other value which is not an integer.

function
&key (min-length 10) max-length required-symbols error

REBLOCKS-UI2/HTML

Functions

function
name &optional default

Macros

macro
(&body body) &key css (html-tag :div) css-classes on-click props width height margin

This macro allows to describe html, state, css and event handlers of the widget. All in the single form.

Here is an example of the simple widget which keeps the counter value in the state and increment it on click:

(html (:p :class "the-title" (fmt "First paragraph with counter: ~A" (prop :counter))) :props '((:counter . 1)) :css (.the-title :font-size 40px) :on-click (lambda (widget) (incf (prop :counter)) (update widget)))

REBLOCKS-UI2/ICON

Classes

ICON-WIDGET

Readers

Functions

REBLOCKS-UI2/INPUTS/BASE

Classes

BASE-INPUT-WIDGET

Readers

A function of one argument returning a validated value or signaling the field-validation-error.

NAMED-INPUT

Readers

REBLOCKS-UI2/INPUTS/CHECKBOX

Classes

CHECKBOX

Readers

reader
(:view = (make-instance 'normal))

Functions

function
&key (widget-class 'checkbox) name value (view :normal) (size :m) disabled checked error

REBLOCKS-UI2/INPUTS/DATE-INPUT

Functions

function
&key (widget-class 'input-widget) name value (format :iso) (required t) placeholder (view :normal) (size :m) disabled error

Returns a native HTML date input.

This is a thin constructor over the usual text input with :TYPE "date" and a valid-date validator attached.

VALUE should be a "YYYY-MM-DD" string, because this is the format browsers use for inputs with type="date".

FORMAT is passed to valid-date and only controls how the submitted data is parsed on the server. By default, the date is required; pass :REQUIRED NIL to allow empty values, in which case the validator returns NIL.

REBLOCKS-UI2/INPUTS/NAMED

Classes

NAMED-INPUT

Readers

REBLOCKS-UI2/INPUTS/SELECT

Classes

OPTION

Readers

SELECT

A select widget allowing to choose one of the options.

Accessors

Readers

reader
(:view = (make-instance 'normal))

Functions

function
options &key (widget-class 'select) name (view :normal) (pin :round) (size :m) disabled validator error

REBLOCKS-UI2/INPUTS/TEXT-INPUT

Classes

INPUT-WIDGET

Accessors

Readers

reader
(:view = (make-instance 'normal))

Functions

function
&key (widget-class 'input-widget) name value (type :text) placeholder (view :normal) (pin :round) (size :m) disabled validator error left-content right-content

REBLOCKS-UI2/INPUTS/TEXT-INPUT/VIEW

Classes

CLEAR
INPUT-VIEW
NORMAL

Functions

REBLOCKS-UI2/INPUTS/TEXTAREA

Classes

TEXTAREA

Readers

reader
(:view = (make-instance 'normal))

Functions

function
&key (widget-class 'textarea) name value (type :text) placeholder (view :normal) (pin :round) (size :m) disabled validator error

REBLOCKS-UI2/MODAL

Classes

MODAL

This widget shows a popup window.

Accessors

Readers

Generics

generic-function
widget &key content header-content

Shows modal window.

Functions

function
content &key header-content visible

REBLOCKS-UI2/SIZES

Functions

REBLOCKS-UI2/TABLES/CELL

Classes

CELL

A thin wrapper around cell content allowing to add such attributes as :colspan or :rowspan.

Readers

Functions

function
widget &key colspan rowspan (cell-class 'cell)

REBLOCKS-UI2/TABLES/CLICKABLE-ROW

Classes

CLICKABLE-ROW-WIDGET

Functions

REBLOCKS-UI2/TABLES/CRUD

Classes

CRUD-TABLE

A search table with Add, Edit and Delete actions.

This widget knows nothing about the persistence: forms are created by ADD-FORM-MAKER and EDIT-FORM-MAKER callbacks, and the deletion is performed by the ON-DELETE callback. All of them are optional: only the corresponding buttons are rendered for the given callbacks.

Readers

The title of the button shown above the table. When ADD-FORM-MAKER is nil, the button is not rendered at all.

A function of two arguments (CRUD-WIDGET modal (1 2)), returning a form widget to show in the modal when the Add button is pressed.

A widget shown as the modal's header content when the add form is opened. When nil, the modal is shown without a header content.

Columns to show. Should not include an actions column, because crud-table adds such a column by itself when at least one of ADD-FORM-MAKER, EDIT-FORM-MAKER or ON-DELETE is given.

A function returning a list of objects to show. Given as is to reblocks-ui2/tables/search:make-search-widget, which calls it with a filters widget as the argument.

The title of the Delete button in the actions column. Also used as the confirm button title of the delete confirmation form. When ON-DELETE is nil, the button is not rendered at all.

A widget shown as the modal's header content when the delete confirmation form is opened. When nil, the modal is shown without a header content.

reader
(:DELETE-QUESTION = "Delete this record?")

A question to show in the delete confirmation form. Either a string or a function of one argument (OBJECT) returning the question string.

The title of the Edit button in the actions column. When EDIT-FORM-MAKER is nil, the button is not rendered at all.

A function of two arguments (modal (1 2) OBJECT), returning a form widget to show in the modal when the row's Edit button for the OBJECT is pressed.

A widget shown as the modal's header content when the edit form is opened. When nil, the modal is shown without a header content.

The modal widget created by the latest RENDER. Useful to hide the modal from application's form callbacks.

A function of one argument (OBJECT), called when deletion of the OBJECT was confirmed in the modal.

A widget class name to create table rows of. Given as :ROW-CLASS argument to reblocks-ui2/tables/search:make-search-widget.

The search widget created by the latest RENDER. Useful to reach the table widget from application's code or in tests.

Functions

Returns the question to show in the delete confirmation form.

DELETE-QUESTION is either a string or a function of one argument, the row's OBJECT, returning the question string.

Returns the value submitted by the form's button named "button".

FORM-DATA is the plist given to a :SUBMIT event handler of a form widget. Reblocks interns the keys of this plist as UPPERCASE keywords, that is why a plain (GETF FORM-DATA :some-other-case) might not find the value. This function compares key names as strings instead and works with any case.

function
columns data-getter &rest restargs &key add-form-maker edit-form-maker on-delete delete-question add-button-title edit-button-title delete-button-title edit-header delete-header add-header row-class widget-class

Returns a table widget with search and Add/Edit/Delete actions.

COLUMNS should not include an actions column: it is added automatically as the last column when at least one of ADD-FORM-MAKER, EDIT-FORM-MAKER or ON-DELETE is given.

DATA-GETTER is given as is to reblocks-ui2/tables/search:make-search-widget and should return a list of objects to show.

  • ADD-FORM-MAKER is called as (FUNCALL ADD-FORM-MAKER CRUD-WIDGET modal (1 2)) and should return a form widget.

  • EDIT-FORM-MAKER is called as (FUNCALL EDIT-FORM-MAKER modal (1 2) OBJECT) and should return a form widget.

  • ON-DELETE is called as (FUNCALL ON-DELETE OBJECT) after the user has confirmed the deletion.

When the library opens a form in the modal, it also subscribes to the form's :SUBMIT event, to update the table after a successful submission: the whole table is updated after the add form was submitted, and only the row's cells are recalculated after the edit form was submitted.

Returns T when FORM-DATA was submitted by a button having the value "submit".

Use this predicate in :SUBMIT event handlers to detect which button was pressed, see form-button-value for the case-sensitivity details.

REBLOCKS-UI2/TABLES/EDITABLE-TABLE

Classes

EDITABLE-COLUMN

Readers

EDITABLE-TABLE-WIDGET

Readers

When given, should be a function of zero arguments. Will be called when user adds a new table row. Usually you will want to do create and add an object to a database. Returned object will be bound to a new table row and used to fill cells with new values.

When given, should be a function of one argument. Will be called with object instance to be deleted from the table. Usually you will want to do something like deletion the record from a database.

ROW-NOT-FOUND

Generics

Deletes row representing given object. First it calls object-deleter callback and then removes corresponding row from the table.

Functions

function
title &key (getter nil getter-given-p) (setter #'default-setter) (cell-maker #'create-widget-from) (align :left)
function
columns rows &key (table-class 'editable-table-widget) (row-class nil row-class-given-p) (object-deleter nil object-deleter-given-p) (object-creator nil object-creator-given-p)

REBLOCKS-UI2/TABLES/SEARCH

Classes

CONTROLS-WIDGET

Readers

SEARCH-WIDGET

Accessors

Readers

TABLE-WIDGET

Readers

Generics

Signals that filters state was changed and table with results should be updated.

Functions

function
columns data-getter &key (filters-widget nil filters-widget-given-p) (controls-widget nil controls-widget-given-p) (widget-class 'search-widget) (table-class nil table-class-given-p) (row-class nil row-class-given-p)

REBLOCKS-UI2/TABLES/TABLE

Classes

COLUMN

Readers

reader
(:cell-maker = #'default-cell-maker)

Additional CSS classes for column cells

reader
(:GETTER = (LAMBDA (ROW) (DECLARE (IGNORE ROW)) (ERROR "Real getter should be provided to COLUMN function.")))
TABLE-ROW

Readers

Original object, passed as a row to the make-table function.

Reference it a table row belong to.

TABLE-WIDGET

Readers

Generics

This generic-function allows to override CSS classes for table row element.

Returns a table widget rendering rows fetched by the search widget WIDGET.

Functions

function
title &key (getter nil getter-given-p) (cell-maker nil cell-maker-p) (align :center) (classes nil clases-given-p)
function
columns rows &key (table-class 'table-widget) (row-class nil row-class-given-p)

Updates cell widgets using base object, stored in the ROW.

REBLOCKS-UI2/THEMES/API

Functions

Macros

macro
name bases &rest var-forms

REBLOCKS-UI2/THEMES/BASE

Classes

BASE-THEME

A base theme class for all Reblocks-UI2 themes.

Readers

reader
(:overridden-vars = (make-hash-table :test 'equal))

REBLOCKS-UI2/THEMES/COLOR

Classes

COLOR

Readers

If string, then it is a color of element in "focus" state. If integer, then it is intensity change relative to the base color. For light scheme intensity will be changed down if number is positive, for dark scheme intencity will go up. Negative number reverses this behaviour.

If string, then it is a color of element in "hover" state. If integer, then it is intensity change relative to the base color. For light scheme intensity will be changed down if number is positive, for dark scheme intencity will go up. Negative number reverses this behaviour.

reader
(:PROPERTY = (REQUIRED-ARGUMENT "property"))

Generics

Functions

function
theme color &key (property nil property-p) (light nil light-p) (dark nil dark-p) (hover nil hover-p) (focus nil focus-p)
function
property &key light dark hover focus

REBLOCKS-UI2/THEMES/STYLING

Generics

Returns classes for a widget or it's property.

Result can be a list, string or a keyword.

This generic function is called before join-css-classes will output classes as a string.

Depending on theme some transformations can be applied to the list of CSS classes, given as CLASSES argument. For example, a theme based on Tailwind framework, might merge CSS classes list allowing to override properties.

Functions

REBLOCKS-UI2/THEMES/TAILWIND

Classes

TAILWIND-THEME

Generics

Macros

Creates a theme object.

Creates a theme object.

Creates a theme object.

REBLOCKS-UI2/THEMES/TAILWIND/ARBITRARY

Classes

ARBITRARY-VALUE

Readers

Functions

REBLOCKS-UI2/UTILS/ALIGN

Classes

HORIZONTAL-ALIGN

Readers

VERTICAL-ALIGN

Readers

Functions

Types

REBLOCKS-UI2/UTILS/MARGIN

Classes

MARGIN

Readers

Functions

REBLOCKS-UI2/UTILS/PADDING

Classes

PADDING

Readers

Functions

Types

REBLOCKS-UI2/UTILS/PRIMITIVE-TO

Functions

REBLOCKS-UI2/UTILS/SIZE

Classes

HEIGHT
RESPONSIVE-HEIGHT

Readers

RESPONSIVE-WIDTH

Readers

SIZE

Readers

If integer, then it will be considered as "px". If string, then will be used as is (meaning depends on current theme).

WIDTH

Functions

Types

(OR HEIGHT RESPONSIVE-HEIGHT)
(OR WIDTH RESPONSIVE-WIDTH)

REBLOCKS-UI2/UTILS/WALK

Generics

A protocol to go through widgets tree and to call VISITOR-FUNC on each node.

REBLOCKS-UI2/WIDGET

Classes

UI-WIDGET

Readers

When an on-click action is given, cursor style will be changed to "pointer".

Generics

Works like reblocks/dependencies:get-dependencies generic-function, but in context of current theme.

Works like reblocks/widget:get-html-tag generic-function, but in context of current theme.

May return a plist of attributes to add to the main widget's HTML node.

It should not return :ID :CLASS or :ONCLICK attributes.

Renders widget in given theme. All reblocks-ui2 widgets should implement this method instead of a method for reblocks/widget:render generic-function.