Page kit
A page an application ships draws with what the framework hands it: the shared components (sdk.ui.*) that Liberty's own editors are made of, and a few views of the framework (sdk.Screen, sdk.Chart, sdk.CodeEditor…). A page built from them looks like the rest of Liberty, follows the dark and light themes and the reader's language, and has nothing of its own to maintain for a list, a figure or a form.
This page is the catalogue. How a page is shipped, opened and granted, and the full list of what it receives with the contract's versions, are in Plugins → Pages an application ships.
At a glance
Writing a page
An application writes each page in TypeScript and JSX (plugins/<app>/pages/<page>.tsx) and builds it into the module the framework serves (<page>.js). The page imports nothing at run time: JSX is compiled to calls of h, which the page takes from the framework's React.
export default function page(sdk) {
const { React, ui } = sdk
const h = React.createElement // what the JSX compiles to
const Fragment = React.Fragment
const { PageLayout, Panel, Stats, Stat } = ui
return function Overview() {
const t = sdk.useTexts('overview') // the application's own texts
const [data, setData] = React.useState(null)
React.useEffect(() => { sdk.call('billing.overview:j_figures', {}).then(setData) }, [])
return (
<PageLayout icon={h(sdk.icon('receipt'), { size: 18 })} title={t.title} description={t.description}>
<Stats>
<Stat value={data?.count ?? '—'} label={t.invoices} />
<Stat value={data?.errors ?? '—'} label={t.rejected} tone="red" />
</Stats>
<Panel title={t.queue} fill>{/* … */}</Panel>
</PageLayout>
)
}
}
A component added recently is checked by its presence (ui.TickCards, sdk.upload) before the page relies on it, so the page still opens on an older framework and says what it needs.
The frame of a page
| Component | What it draws |
|---|---|
PageLayout | The page's header — icon, title, description, headerRight — over its scrolling content. embedded: inside another page, no header; bare: the header only, the children bringing their own surface. |
HeaderActions | The page's own buttons placed in its header, beside what the header already holds: an editing page puts its Discard / Save there, as Liberty's builders do. Shown inside a window or another page, the same buttons sit in a row at the top. |
EditorModalShell | The editors' dialog: the title (with an unsaved badge), ✕ at the top right, an optional tab bar, the body as the only scrolling part, Cancel / Save at the bottom right, anything else (a Delete) at the bottom left. A stray click outside does not close it. |
Panel | A card with its heading strip: icon, title, badge (what it holds, its actions), step (1, 2, 3… for a page read as steps), toolbar under the heading, footer under the body. plain: a plain heading with sub under it. wide / flush: the body to the panel's width or edges (a grid, a diagram). Without title, badge, step or icon, no heading strip is drawn. |
Panel fill | The panel takes the height it is in — beside a list, down to the page's bottom — and its body scrolls (a log, a grid). A panel among others keeps its own height. |
Toolbar, Row, Stack | A bar of controls; controls on one line; a column with a gap. |
SectionTitle, Section, Hint | The uppercase heading over a part of a page (blue inside a panel), a titled part, the muted line that explains. |
useToasts, useModals | A notice at the bottom right; the confirmation, prompt and choice dialogs. |
The rule for buttons follows Liberty's editors: a page that edits something has Discard / Save in its header (HeaderActions); a form shown inside another page has its own Cancel / Save.
Picking from a list
NavList, NavPanel, NavSplit
The list beside its panel, as in Liberty Next → Administer → App: grouped lines on the left, the picked one on the right with its heading.
<NavSplit>
<NavList value={picked} onPick={setPicked} header={<Chips>…</Chips>}
groups={[{ id: 'todo', title: t.toCorrect, count: 2, items: rows.map((r) => ({ id: r.DOC, title: r.DOC, mono: true, sub: r.REASON, dot: !r.READ, aside: <Tag>UBL</Tag> })) }]} />
<NavPanel title={picked} badge={<Tag>…</Tag>} fill>{/* the picked line */}</NavPanel>
</NavSplit>
| Part | Settings |
|---|---|
A line (NavItem) | id, title, sub (what it holds, its state), icon, aside (a count, a tag, a time at the end), dot (unread), hint (tooltip), mono (title in the code font), data (data attributes). |
A group (NavGroup) | id, title, items, count at the end of its heading, after (a hint, "12 more", a button after its lines), fold ({ open, onToggle }: the group folds, its heading and count kept). |
| The list | width (300 px by default, at most a third), header kept at its top (a search, chips — opaque, the lines do not show through), footer, empty. |
Chips, Segmented
| Component | What it draws |
|---|---|
Chips / Chip | The pill of a filter with its count (All 29 · Unread 12 · Errors 3): on when picked, count in the chip's tone, icon; onRemove adds a × for a value that may be taken out. |
Segmented / Segment | Two to a few choices side by side, one picked (a view, a mode, allow / deny), in its tone. A field's height by default, so it lines up with an input or a button; small for icon-sized segments, tall for a filter bar. |
FilterOp | The operator of a filter field — contains, equals, starts with…, a list included or excluded, is empty / is not empty — for a page that filters through its own API. |
PickCards, TickCards
| Component | What it draws |
|---|---|
PickCards | Cards to pick one thing from — a template, a source, a connector: title, tag, sub (the line under it), icon, mono, disabled, search (more words the filter looks in). A filter is offered past eight cards (filterFrom); min sets a card's narrowest width, maxHeight makes them scroll. |
TickCards | The same cards, several ticked — a report's sections, the parts of an export: a box on each, "n of m ticked", All / None; values the ticked ids, onChange the new ones in the cards' order. A ticked card says it by its box, its frame only a shade apart. |
ViewCards | The views of a page as a row of cards — an icon, the name, one line on what the view is for —, the picked one tinted in its colour; compact keeps the row short, cols sets its number of columns. |
Saying what a thing is
StageStrip
A task drawn as its stages — the look of the screen designer and the Pools editor: cards in a row joined by lines, each with its tone, icon, title and what it holds; a click opens the stage.
<StageStrip current={stage} onPick={setStage} end={<Button $variant="primary" onClick={run}>{t.run}</Button>}
stages={[
{ id: 'source', tone: 'blue', icon: h(sdk.icon('database'), { size: 14 }), title: t.source, what: 'crm · invoices' },
{ id: 'check', tone: 'purple', icon: h(sdk.icon('shieldcheck'), { size: 14 }), title: t.check, what: t.rules, warn: !rules.length },
]} />
A stage takes id, tone (blue, green, purple, orange), icon, title, what (its main line), more (a second line) and warn (the line in orange: something is missing). end is what closes the line — the task's action (Run, Process). compact draws narrower cards for a strip in a panel beside a list; dense keeps one line per card, the second in its tooltip.
Figures
| Component | What it draws |
|---|---|
Stats / Stat | A page's key figures as tiles: value large in its tone, label, note; onClick makes the tile open what it counts, on marks it when that is what the page shows. Stats fits as many tiles as the width allows (min, 150 px) or cols of them. |
sdk.Kpi | The dashboards' figure card: label, value, its change against previous (good or bad as lowerIsBetter says, muted with neutral), format (number, integer, currency, percent, or a function), hint under it, a coloured edge (tone), onClick. changeIn="points" writes a rate's change in points (80 % → 90 % is "+10 pts", not "+12.5 %"); shown replaces the written value (a net without its sign) while the change is computed on value. |
Meter, StackedMeter | How full something is, as a thin bar (value in percent, warn orange, alarm red, or a tone); parts of a whole on one bar, each its share, with a legend. |
Refresh | The refresh icon at the end of a bar, with "Updated 10:11": the time the page's data was read, or at, the server's time of a kept answer. |
Facts, findings, lines
| Component | What it draws |
|---|---|
Facts | Label → value, as a list, a grid, tiles or inline; a fact may be mono, take a tone that asks for attention, a hint. A fact that is null is left out. |
Findings / Finding | What a check found, one line each: its level's colour (tone) as a dot or, with card, a coloured edge; label (the level's word), area (what it concerns), the sentence. |
LineButton | A line of a card that opens what it says: main, sub, value at the end. |
EventLine | A line of a history: a tag, what happened, when, the message under it. |
TreeRows / TreeRow | A tree drawn as rows: the page flattens it, each row with its depth, folder / open for the fold mark, label, sub, aside. |
SimpleTable | A small read-only table with its total — a summary, not the data grid. |
Forms
FieldGrid / GridField lay a form's fields on one grid, as Liberty Next → Administer → App does: labels, controls and explanations aligned whatever their length. A field's explanation (help) takes one line, cut with an ellipsis: the whole of it on hover, unfolded by a click; brief={false} writes it in full. wide spans two columns, or 'full' the line. A field alone, outside a grid, is Field.
Lists, charts and text
| View | What it draws |
|---|---|
sdk.Grid | The shared grid — search, filters, sort, grouping, columns, export, the user's saved views. detail opens a row; selection ({ key, selected, onChange, selectable? }) adds a box per row and one in the heading for every row the search and filters leave, the selection kept through a sort or a filter. |
sdk.Chart | Rows as bars (bar, stacked, upright or horizontal), line, area, pie or donut, with the look of the dashboards' charts: data, x (the category), series (key, label, color — a theme colour by name or any CSS colour), height, format, legend, onPick (the row clicked), empty. The chart library is loaded the first time a page draws one. |
sdk.Pivot | Rows as the Data Explorer's pivot: the dimensions the reader picks as a foldable hierarchy with subtotals, a column spread across, the measures to choose among, each value's share (percent: of the level above, of the total, or none), totals, Excel (exportName). |
sdk.Markdown | Markdown text drawn as the framework draws it (release notes, a flow's description); compact for a side panel. |
A screen inside a page
<sdk.Screen app="billing" screen="value_lists" values={{ LIST_NAME: 'countries' }} /> shows a framework screen inside the page, opened on the values given (its parameters and filters by name): its grid or reader, its record form, saves and actions — the page keeps its own frame (a catalogue, a list beside a panel) and stops redrawing lists and forms. The screen has no header of its own there, and the values the page gives are not offered again at its top; changed values open it again on them.
light draws it quietly: one toolbar line — the screen's own buttons (add, bulk edit, its actions) and the search —, the grid's tools (run again, rows read, views, filters, group, columns, export, the view switch) folded behind one ⋯ button, the "n rows · ms" line left out unless it has a warning to give. Every grid inside follows, a form's nested grid too.
sdk.Record opens a screen's record form alone, and sdk.Import its import dialog — see Plugins.
Code and documents
sdk.CodeEditor
<sdk.CodeEditor value={xsl} onChange={setXsl} language="xml" height={560} /> — Liberty's code editor, themed, with line numbers and folding, for an XML, a stylesheet, a JSON; readOnly to show it only. It is loaded the first time a page draws one.
caretRef={ref}hands the editor's cursor in a text field's shape:<ui.PlaceholderPicker targetRef={ref} options={…} value={…} onChange={…} />then puts a name where the cursor is, in a query or a JSON body, as it does in a text box.original={text}shows two texts side by side, the original on the left andvalueon the right, the differences marked (read only) — as Liberty's configuration versions are compared.
A document designer
| Component | What it draws |
|---|---|
sdk.PdfView | A PDF page by page — data as bytes, a Blob or base64 — with the regions a server says it drew laid over it: regions, picked, onPick (a click picks a region), scale (left out, the page fits its frame), loading (the PDF shown stays, dimmed, while the next one comes). The PDF library is loaded the first time a page draws one. |
sdk.parseRegions | Reads the regions a server sends as base64 JSON in a header — NomaUBL's X-Pdf-Regions — as PdfView takes them. |
ui.DocDesigner | A designer's frame for a document made of ordered sections: the whole document's settings in a strip above, the sections in print order on the left (picked, dragged with onMove, removed with onRemove, added from a palette), the preview in the middle — often a PdfView —, the picked section's settings on the right (inspector, inspectorTitle, inspectorSub). |
ui.BlockTree | An outline of nested parts — a column holding rows holding texts and fields: each part on its line under its parent, its kind as a tag, one picked. |
The designer draws; what a section is, and how the document changes, belongs to the page and its server.
Files
| Component | What it does |
|---|---|
ui.DropZone | A place files are dropped on — files or whole folders from the computer, onto any part of the page it wraps: an outline with its label ("Drop to put them in Outbound") while they are dragged over, a hint under it; each file comes with its path inside the folder dropped. disabled refuses them. |
ui.pickFiles({ folder?, accept? }) | The computer's own picker, for several files or a folder with what it holds — the button beside the drop zone. |
ui.FileViewer | A file shown by its kind: a PDF drawn, an image, a text — XML, JSON, CSV, a log, code — in the read-only code editor, XML and JSON laid out (As it is one click away); anything else says it has no preview, and the page offers the download. |
sdk.upload, sdk.fetchFile, sdk.downloadFile | The files sent to a function, with the progress of the bytes sent and an AbortSignal to stop; a file a function answers, to show ({ blob, name, type }) or to save — see Plugins → Files in and out of a function. |
sdk.fileKind, sdk.sizeText | What a file is by its name and type (pdf, image, text, other — what FileViewer shows); a size in words (840 KB, 2.4 MB). |
Environments
<ui.EnvironmentsEditor app="billing" /> is the form that sets up an application's environments, the one Liberty itself uses — see Environments. Per application, its environments; the picked one's parts (its database, the servers it calls) as stages, and the picked part's pool whole, in the Pools editor's own form (database, account, schemas, database links, tuning, Test connection). Superusers only: the server refuses anyone else.
| Setting | Effect |
|---|---|
app | One application only. |
prefill | Opens on a new environment, filled in: its name and its parts' addresses ({ app, name, parts: { db: { url } } }). |
formOnly | Just the form of that environment, no list — a page attaching one in place. |
onSaved, onCancel | Told the environment saved, or that the form is left. |
As a page, the editor has Discard / Save in the page header; shown inside another page (onCancel given), its own Cancel / Save.
Icons
sdk.icon(name) gives a menu icon by its name (or null), drawn as a component: h(sdk.icon('receipt'), { size: 14 }). Names are matched ignoring case and punctuation; they are the menus' own icons:
activity, alert, arrowdown, arrowup, barchart, bell, belloff, bellring, book, briefcase, building, calendar, check, clock, code, compass, database, download, externallink, eye, file, filebarchart, filetext, filter, filterx, folder, folderplus, folderup, gitcompare, globe, grid, harddrive, history, key, layers, layoutdashboard, link, lock, mail, mailopen, messagesquare, network, package, palette, pause, play, plus, receipt, refreshcw, rocket, search, send, settings, shield, shieldalert, shieldcheck, sparkles, table, tag, trash, trendingup, upload, user, usercheck, users, wand, workflow, wrench, zap.
Good practices
- Take the component before drawing one. A list beside a panel is
NavSplit, figures areStatsorsdk.Kpi, a check's result isFindings: the page then reads like Liberty's own editors and follows its changes. - Show a screen rather than redoing it. A list with its record form is
sdk.Screen(oftenlight): its rules, saves and actions come with it. - Keep the texts in the application's locales (
sdk.useTexts), never in the page's code — see i18n. - Check a recent component by its presence and say what the page needs when it is missing.
What's next
- Plugins → Pages an application ships — the contract, its versions, opening a page on something.
- i18n — the languages and the applications' texts.
- Environments — an application's environments, set up from one form.