GolemUI v2.2.0: checkbox groups, ratings, badges, progress bars and spinners
GolemUI v2.2.0 is out. GolemUI Components gets five new elements: two inputs, a checkbox group and a star rating, and three ways to show status, a badge, a progress bar and a spinner. The two inputs are GolemUI Forms widgets too. On the Forms side, a repeater can now be read-only or disabled, and a new setHealth method lets your app stop a form when something it can’t see goes wrong, such as the server it saves to.
Checkbox groups and ratings
Section titled “Checkbox groups and ratings”gui-checkbox-group lets the user check any number of options. Its value is the list of the checked values, always in the order of the options, whatever order the user checks them in. The boxes are native checkboxes in a group named by its label, so screen readers read the group and its options, and a required group says so in its name.
gui-rating scores something from 1 to 5 stars, or to any max you set. The stars are native radio buttons: the arrow keys move between them, screen readers read “3 stars”, and the pointer previews a rating as it moves. A click on the picked star clears it, and so does Delete. Check some toppings and rate the pizza:
<div class="gui-grid"> <gui-checkbox-group label="Toppings" hint="Pick as many as you like" options='["Cheese", "Ham", "Olives", "Mushrooms"]' direction="row" ></gui-checkbox-group> <gui-rating label="How was your pizza?"></gui-rating></div>Both take part in native forms, with name, required, disabled and readonly like every other input. See Checkbox group and Rating.
Badges, progress bars and spinners
Section titled “Badges, progress bars and spinners”gui-badge is a short label for a status or a count, in the same intents as the alert: neutral, info, success, warning and error. gui-progress shows how far a task has got on a native <progress>, with its label and, if you want it, the percentage in the reader’s locale. Without a value it shows that the task is running. gui-spinner is for a wait of unknown length: the glyph is decorative, and its label goes to a status region that screen readers announce. Run the upload:
Invoice #1042
<div class="gui-grid"> <p> Invoice #1042 <gui-badge variant="success">Paid</gui-badge> <gui-badge variant="info">3 new comments</gui-badge> <gui-badge variant="warning">Due in 2 days</gui-badge> </p> <gui-progress id="upload-progress" label="Uploading report.pdf" value="40" show-value ></gui-progress> <gui-progress label="Preparing the export"></gui-progress> <div class="gui-grid gui-grid--row gui-grid--justify-start"> <div class="gui-grid__cell"> <gui-button id="upload-start" label="Upload again" variant="outlined" ></gui-button> </div> <div class="gui-grid__cell"> <gui-spinner id="upload-spinner" hidden></gui-spinner> </div> </div></div>The spinner takes the text color and sizes itself from --gui-spinner-size, so it fits in a line of text or a button. See Badge, Progress and Spinner.
What’s new in GolemUI Forms
Section titled “What’s new in GolemUI Forms”Checkbox Group and Rating widgets
Section titled “Checkbox Group and Rating widgets”The Checkbox Group and Rating widgets work in JSON and in the gui.* API, in all four frameworks, with their selectors (checkboxGroups, ratings and their ByUid twins).
import { gui } from '@golemui/gui-shared';
const formDef = [ gui.inputs.checkboxGroup('toppings', { label: 'Toppings', options: [ { label: 'Cheese', value: 'cheese' }, { label: 'Ham', value: 'ham' }, { label: 'Olives', value: 'olives' }, { label: 'Mushrooms', value: 'mushrooms' }, ], validator: { required: true, maxItems: 2, messages: { invalid: 'Pick a topping', required: 'Pick a topping', maxItems: 'Pick at most two', }, }, }), gui.inputs.rating('service', { label: 'Service', validator: { required: true, messages: { invalid: 'Rate the service' } }, }),];A checkbox group takes an array validator: required means at least one checked, and minItems and maxItems set the bounds. A rating takes an integer validator, and its maximum is the number of stars, so there is no separate prop to keep in sync.
Read-only and disabled repeaters
Section titled “Read-only and disabled repeaters”A repeater now respects readonly and disabled, as a boolean or a when rule. A read-only repeater shows its rows with no Add and no Remove button, and a disabled one shows both buttons, disabled. The flags don’t pass down to the rows on their own: give the row’s widgets the same rule, so one value locks the list and its fields together. Approve the order:
setHealth
Section titled “setHealth”A form reports its own problems through formHealth: a definition that doesn’t parse, an expression that fails. Some problems happen outside the form, though. If your form saves each change to a server and the server goes down, the user should stop typing changes that can’t be saved.
setHealth sits next to setData and setMeta on the form, in React, Angular, Vue, Lit and plain HTML. An errored health freezes the form and shows the formHealthBoundary, exactly as an error of the form’s own would. { status: 'ok' } brings it back.
form.setHealth({ status: 'errored', code: 10_001, message: 'The server cannot be reached',});
// Later, when the server is back:form.setHealth({ status: 'ok' });Codes below 1000 belong to the core, so pick yours from 1000 up. See setHealth.
Other changes
Section titled “Other changes”- The MCP server now teaches agents how to load a dropdown’s items at runtime and how to search on the server as the user types, with the
loadandfilterevents. Theloadevent fires once, when the widget mounts in the browser. inputDebouncehas one default, 500 milliseconds, whether the dropdown filters its own items or sends afilterevent.- Sliders in right-to-left pages keep a formatted value such as “65 %” in its own order.
gui-checkboxandgui-checkbox-groupshare the--gui-checkbox-*tokens, so one setting styles both.
Upgrading
Section titled “Upgrading”Upgrade every @golemui/* package to 2.2.0 at once. Nothing in this release needs a change in your code.
The full list of changes is in the changelog.