TotalBase
Widgets

Widgets

The widgets a page or a form is built from: how they work, and every one of them.

In the admin: Design form › Widgets

A widget is anything you can place on a page: an input, a table, a heading, a card, a map, a signature pad. The palette is the widget catalog: what's in it can be placed, and nothing else can. Most widgets are Nuxt UI components under their own names and with Nuxt UI's look; a few are TotalBase's own, such as the Scanner or the Signature.

Each group has its page, with what each widget is for and its whole reference: Form, Inputs, Display, Embeds, Layout, Overlays and Actions. Dashboards have their own widgets, in Dashboards › Widgets.

How a widget works

Every widget follows the same model, Nuxt UI's own:

Part
PropsIts configuration, in the inspector. A prop can be fixed, bound to a variable (an input's value, a table's rows) or computed by a formula (a label, a color, whether it's visible or disabled)
SlotsAreas that hold other widgets: a Card's header, body and footer; each tab's content
EventsWhat it emits, each wired to a function of the page's Code: a Button's click, an input's change
MethodsWhat Code can ask of it: open a modal, focus an input, clear a signature

Give a widget a Name to reach it: a formula reads {{controls.selectCustomer.value}}, and Code calls dataview.controls.modalSign.open(). Keep names unique on the page.

Widgets never know tables, functions or workflows. They show and change variables, and the page's code connects them.

Visible, and the rest every widget has

Every widget also has, under Advanced:

  • Visible: a formula. A hidden widget takes no space and leaves the page. Hidden, still active keeps it on the page unseen, such as a Scanner listening to the whole page.
  • CSS classes: Tailwind classes of its own. max-sm:h-auto! lets a fixed-height widget grow with its content on a phone; for a Splitter, add max-sm:[&_[data-panel]]:flex-none! and max-sm:[&_[data-panel]]:h-auto! so its panels do too.
  • Read only, for inputs: shown, never changed.

How to read a reference

  • The code name (USelectMenu) is what the MCP tools and the Admin API take. U names are Nuxt UI components, with Nuxt UI's own prop names and look; T names are TotalBase's own.
  • Edits lists the column kinds an input can edit; A form field's input means it can go inside a Form field.
  • Takes says what a prop can be bound to besides a fixed value: ƒ a formula, a Value or a Resource a variable of that kind, per option a field or a formula per option.
  • The JSON examples are configurations as add_page_widgets takes them: props fixed, bindings bound, emits wired to functions of the page's Code.

Every widget

WidgetCodeGroupForEdits
FormUFormFormGroups fields: checks the required ones and emits submit with { data } - the fields' values by name.
Form fieldUFormFieldFormA labelled field around one input: label, help, required.
InputUInputInputsA single-line text field.text, number, date, time, timestamp
TextareaUTextareaInputsMulti-line text.text, JSON
NumberUInputNumberInputsA number, with increment and decrement buttons.number
DateUInputDateInputsA date, a date and time, or a date range.date, timestamp, date range
TimeUInputTimeInputsA time of day, or a time range.time, time range
SwitchUSwitchInputsAn on/off value.boolean
CheckboxUCheckboxInputsA yes/no value.boolean
SelectUSelectInputsPick from a short list - no search.text, foreign key
Select menuUSelectMenuInputsPick from a list, with search.text, foreign key
AutocompleteUInputMenuInputsType to find an option.text
Radio groupURadioGroupInputsPick one of a few options, all visible.text
TagsUInputTagsInputsA free-form list of short text values.array
Checkbox groupUCheckboxGroupInputsPick any number of options, all visible.array
ListboxUListboxInputsA visible, filterable list to pick from.text
PIN inputUPinInputInputsA short code with a fixed number of characters.text
SliderUSliderInputsA number picked along a bounded range.number
RatingUInputRatingInputsA star rating out of a fixed maximum.number
File uploadUFileUploadInputsA single uploaded file or image.file
ScannerTScannerInputsReads a QR code, a PDF417 (a DNI) or a barcode - with the device's camera or a USB reader in keyboard mode - and emits what it read.text
CameraTCameraInputsTakes a photo with the device's camera, crops and compresses it, and stores it as a file - for a file column, like a person's photo.file
SignatureTSignatureInputsA pad to sign on with a finger or the mouse - stored as a PNG file, its value the file's id, like a Camera's. Clear starts over; a few ink colors. In a modal behind a button, with the signature shown on the page by a read-only Signature or Camera on the same column.file
Rich textUEditorInputsA rich text editor - Markdown, HTML or JSON content.text, JSON
JSONTJsonInputsStructured data, edited as a tree.JSON
ColorTColorSelectInputsA palette color or any hex color.text
Map (Leaflet)TLeafletMapInputsA point picked on an OpenStreetMap map - or the device's own position, with My location.point
LocationTGeolocationInputsThe device's position into a point column, no map - a button, the coordinates once captured. Auto takes it when the field opens empty: where a reading was taken.point
RangeTRangeInputInputsA PostgreSQL range - from and to, with the date or number inputs its type takes; empty, no value.range
ImageTImageDisplayAn image - one uploaded here, a file of the record () or a URL; with its caption, an icon or a text when there's none, and Clicked to use it as a button.
HeadingTHeadingDisplayA section title.
TextTTextDisplayA paragraph - its content can be a formula.
QR codeTQrCodeDisplayA QR code of a value - drawn in the browser, never sent anywhere: a device's pairing code, a link. Empty, it says so instead of an unreadable code.
ResultTResultDisplayA large panel for an outcome at a glance - a color, an icon, a title and a description, with a tone and a vibration - shown by the page's Code with dataview.controls..show({ color, icon, title, description, sound, resetAfter }); it goes back to its waiting state on its own after Reset after seconds. A kiosk's answer to a scan.
TableUTableDisplayRows of a Resource - its columns are the Resource's fields.
BadgeUBadgeDisplayA short label.
AlertUAlertDisplayA message with a title and a description.
SeparatorUSeparatorDisplayA rule between sections, with an optional label.
ProgressUProgressDisplayA progress bar.
AvatarUAvatarDisplayAn image, initials or an icon in a circle.
UserUUserDisplayA name and a description beside an avatar.
Empty stateUEmptyDisplayAn icon, a title and a description for "nothing here yet".
IconUIconDisplayA single icon.
DataViewTDataViewEmbedsAnother DataView inside the page - its grid, cards, map, board, calendar or timeline, its New and its record form. Linked by a column: the rows that belong to the page's record (an order's items, a person's history); without: every row its own filter allows.
DashboardTDashboardEmbedsA published Dashboard, its variables set from the page - a customer's own figures, for one.
FrameTFrameEmbedsAnother site's page in a sandboxed frame - its URL may take values from the page, e.g. the record's tracking number.
CardUCardLayoutA framed section with a header and a footer.
BoxTBoxLayoutA plain area grouping widgets - no frame of its own: its look is its Style (padding, border, background, radius).
TabsUTabsLayoutSections one at a time, under a tab strip.
AccordionUAccordionLayoutSections that expand one (or several) at a time.
CollapsibleUCollapsibleLayoutA trigger that shows or hides its content.
SplitterUSplitterLayoutPanels side by side, or one above the other - the viewer drags what's between them; each panel scrolls on its own.
Scroll areaUScrollAreaLayoutA box with its own height that scrolls what it holds - its look from the Style tab.
ModalUModalOverlaysA dialog over the page.
SlideoverUSlideoverOverlaysA panel sliding in from an edge.
DrawerTDrawerOverlaysA panel rising from the bottom - TotalBase's own drawer, for working on something with room.
PopoverUPopoverOverlaysA small panel anchored to its trigger.
TooltipUTooltipOverlaysA hint shown over its content on hover.
Dropdown menuUDropdownMenuOverlaysA menu of actions under its trigger - each item runs a Code function.
ButtonUButtonActionsRuns a Code function on click.

Next steps