Changelog
Releases
Every release of Slab, newest first, with what's changed in each. It's the package's CHANGELOG.md, and the bigger releases have a page of their own, with live examples.
-
1.3.1
- Command Palette's result count and its
emptyslot's text are announced by VoiceOver in Safari again. They're now announced from the palette's input, inside its modal dialog, rather than from the host. That also keeps them inside the dialog in browsers withoutariaNotify(), where everything outside it is inert. There's nothing to update. #252 - Copy Button's "Copied" and "Couldn't copy" are announced by VoiceOver in Safari. Safari's VoiceOver didn't read the status region they're announced from, so in Safari, and every browser on iOS, they're now also announced through an announcement of their own. Nothing changes in other browsers, and there's nothing to update. #251
- Listbox now tells VoiceOver in Safari when Space or Enter selects or deselects the active Option. Safari doesn't pass the active Option on to VoiceOver, so before, the change often went unsaid. #254
- Range Slider now tells VoiceOver in Safari the value a thumb moves to with Home or End. VoiceOver moves to the slider's label on those keys, so before, the new value went unsaid. Nothing changes in other browsers, and there's nothing to update. #258
- Toast is announced by VoiceOver in Safari. Safari's VoiceOver doesn't announce content slotted into a live region, so in Safari, and every browser on iOS,
show()now also announces the toast's text itself. Nothing changes in other browsers, and there's nothing to update. #250 - Tree now tells VoiceOver in Safari when Enter or Space selects or deselects the active Tree Item. Safari doesn't pass the active item on to VoiceOver, so before, nothing was said. #253
- Command Palette's result count and its
-
1.3.0
What's new in 1.3.0 Date Time Picker, drag and drop beyond reordering with Draggable and Drop Zone, Sortable Lists that trade items, and smaller bundles.- Date Time Picker
- Draggable and Drop Zone
All 5 changes
New component: Date Time Picker (
slab-date-time-picker), a Date Time Field with a button that opens a Calendar and a time input in a popover, as Date Picker does for a date. #242- It's Date Time Field, so the value, the time zone select, validity and the form work the same.
- Picking a day keeps the value's time, and changing the time keeps its day. The picker stays open until Escape or a click outside.
open,showPicker(),hidePicker(), "beforetoggle" and "toggle" work as on Date Picker, and so domonths,week-startandisDateUnavailable.- Name the button with
button-labeland the time input withtime-label, or withdateTimePickerButtonanddateTimePickerTimeinregisterStrings().
New components: Draggable (
slab-draggable) and Drop Zone (slab-drop-zone), for drag and drop beyond reordering, such as moving a card between the columns of a board. #243- Drag a Draggable by its handle, a
<button>, with a mouse or a finger, and it follows the pointer. Or press Space or Enter on the handle to pick it up, the arrow keys to move between the Drop Zones that take it, Space or Enter to drop it, and Escape to cancel. Screenreaders hear each step. - Both dispatch the drag events native drag and drop does, as
DragEvents with aDataTransfer, however the drag is made: "dragstart" and "dragend" on the Draggable, and "dragenter", "dragover", "dragleave" and "drop" on Drop Zones. Set what's dragged withdataTransfer.setData()in "dragstart", and read it withgetData()in "drop". - Neither moves anything. Do what a drop means in the Drop Zone's "drop". "dragend"'s
dataTransfer.dropEffectsays whether the Draggable was dropped. - A Drop Zone takes what matches its
accept, a comma-separated list of data types such as "application/x-task" or "text/*", and sets itsdrop-effect("move", "copy" or "link") as the drag'sdropEffect. It also takes native drags from outside Slab, such as a link from another window. Style it with:state(droppable)and:state(over), and a Draggable with:state(grabbed). - Word what screenreaders hear with
instructions-labeland thegrabbedLabel,overLabel,droppedLabel,canceledLabelandnoDropZonesLabelfunctions, or with thedraggable*strings inregisterStrings().
- Drag a Draggable by its handle, a
Sortable List has a
groupattribute. Sortable Lists with the samegrouptrade items, like the columns of a board. #245- Drag an item over another list in the group and it moves there, landing where the pointer is among that list's items.
- With the keyboard, Left Arrow and Right Arrow move a picked up item to the previous or next list in the group, in page order. They're swapped when text runs right to left.
- When an item is dropped in another list, both lists dispatch "change". Escape puts it back in the list it came from.
- Screenreaders hear "Walls moved to Done, position 1 of 2" and so on, which you can reword with
movedToListLabel, or withsortableListMovedToListinregisterStrings(). A grouped list's handles are described with the left and right arrow keys too (sortableListGroupInstructions).
- Each element now bundles only its own English strings, rather than every element's, which takes up to about 1 KB, gzipped, off an app, however many elements it imports.
registerStrings()and theStringstype are unchanged. #246 - Table Row's published types declare
TableRowSelectionagain. 1.2.0 left it out oftable.row.class.d.tswhileprivateSetSelection()still named it, so a project that type-checks withskipLibCheck: falsefailed with "Cannot find name 'TableRowSelection'". #247
-
1.2.0
What's new in 1.2.0 Date Time Field with time zones, row selection in Table, currency and unit formats in Number, unavailable days in Calendar, and class-only imports.- Date Time Field
All 5 changes
Calendar can now mark days as unavailable and show more than one month at a time. Date Picker and Date Range Picker pass both to their Calendar. #230
isDateUnavailableis a function of a "yyyy-mm-dd" day that returnstruefor a day that can't be picked, such as a weekend or a day that's already booked. An unavailable day can still be focused, so the arrow keys move across it, but it can't be selected. It'saria-disabledand::part(unavailable). Withrange, a range can't span an unavailable day. Set a new function when what it returns changes.monthsshows that many months side by side. Each has its own grid and::part(month-heading), and the heading between the buttons names them all. The months shown follow the focused day, and the previous and next buttons move them a month at a time.
Calendar's grid is now inside two new parts,
::part(months)and::part(month), which you can use to lay out several months. Styles that select Calendar's parts work as before.Every element has a class module beside its registering one, such as
slab-elements/tabs.class.jsbesideslab-elements/tabs.js. It exports the same class and registers nothing, so you can register the element under a tag of your own, in a scoped custom element registry, or on a page that might load two versions of Slab. A class module registers none of the element's parts either, so register those too. Elements find their parts by class, so any tag names work. Nothing changes forslab-elements/<name>.js, which still registers its tag and its parts' tags. #236When you subclass an element, import the class from its class module, so the
slab-tag isn't registered along with yours.Date Picker and Date Range Picker now render their Calendar from a scoped registry of their own where the browser supports one, so they don't need
slab-calendarregistered globally. In browsers without scoped registries, register Calendar asslab-calendarwhen you use their class modules.sideEffectsin package.json now lists the registering modules by name, so bundlers can drop an imported class module that goes unused.New component: Date Time Field (
slab-date-time-field), a date and time field around a native<input type="datetime-local">, with a native select of time zones beside it. #235valueis the native input's "yyyy-mm-ddThh:mm" wall-clock time, andmin,max,stepand validity are the input's own.time-zoneis an IANA name, such as "America/Chicago", and the browser's own when unset. The person can change it from the select, which lists every time zone the browser knows, or those intime-zones, each with its offset from UTC at the value's date. Changing it dispatches "input" and "change" and keeps the value.- The value is submitted under
name, and the time zone undertime-zone-namewhen it's set. valueAsDateis the moment the value is in its time zone, and setting it writes that moment's wall-clock time.- Name the select with
time-zone-label, or withdateTimeFieldTimeZoneinregisterStrings().
- Number has a
format-optionsattribute, and aformatOptionsproperty, that takeIntl.NumberFormatoptions for a currency, a percent or a unit, such asformat-options='{"style":"currency","currency":"USD"}'. The field shows its value formatted in the language of the nearestlang, and reads what's typed, such as "$1,234.50" or "12 %", back into a number.valueand the submitted value stay a plain number, and a percent's is a fraction, asIntlformats one, so 0.12 shows as 12%. Text that isn't a number isbadInput, with the message "Enter a number.", whichregisterStrings()translates asnumberBadInput. Withoutformat-options, Number is the native number input it was. #229 - Table rows can be selected. Set
selectableon a Table for one row at a time, ormultiplefor more than one, and each body row starts with a check box that selects it, named "Select" and its row header's text. Withmultiple, the head row gets a check box that selects every row, or none, and Shift with a click selects a range. Table dispatches "change" when the user changes the selection, and hasselectedRowandselectedRows. Table Row hasselectedanddisabled,:state(selected),:state(selectable)and:state(disabled), andcheckboxandselection-cellparts. Name the check boxes withselect-all-label,selection-labelandselectRowLabel, or withtableSelectAll,tableSelectRowandtableSelectioninregisterStrings(). #228
-
1.1.0
What's new in 1.1.0 Validation errors from markup, more of the native form, field and popup APIs, and Ember types.All 9 changes
Every form control now has a
custom-validityattribute and avalidity-messageslot, to make validation errors easier to show. #216custom-validityissetCustomValidity()from markup. The control is invalid with that message, and the message shows right away, without waiting for validity to be reported. Use it for errors you already know about, such as ones from a server. Remove it, or set it to an empty string, to make the control valid again.- Content in the
validity-messageslot shows in place of the validity message's text, while the control is invalid and its message shows. Use it for wording of your own, a translation or a link.validationMessageis unchanged.
Cancelling a control's "invalid" event now keeps its validity message unshown, as its documentation said, and as cancelling one on a native control keeps its validation bubble from showing. That covers a blur, a submit and
reportValidity(). On a submit, the control isn't focused either. The control stays invalid.Also fixed: on Checkbox, Checkbox Group, Combobox, Listbox, Radio Group, Rating, Select and Switch, a message from
setCustomValidity()on a control that wasn't required was cleared by the control's next update.Code that doesn't cancel "invalid" works as before.
- Form controls now have the defaults that native inputs have. The fields, Select, Combobox, Listbox, Slider and the other controls that take one
valuehavedefaultValue. Checkbox, Switch and Radio havedefaultChecked, and Option hasdefaultSelected. Range Slider and Date Range Field (and Picker) havedefaultStartValueanddefaultEndValue. Checkbox Group and Radio Group reset through their Checkboxes' and Radios'defaultChecked, and File Drop, like a file input, has no default. Each is the attribute the control starts with and goes back to when its form resets, so reading it reads the attribute, and setting it sets the attribute. Nothing changes for existing code. #211 - Ember templates can now be type-checked with Glint. Add
import type {} from 'slab-elements/ember.js';once, in a.d.tsfile. Glint then checks each tag's attributes by their HTML names, such ashide-labelandorientation, so a misspelled attribute or a wrong value is a type error.SlabElementAttributesinslab-elements/jsx.jsmaps each tag to its attributes, for other frameworks that set attributes. Nothing changes for existing code. #217 - Every form control now has a read-only
labels, as native inputs do. It's the<label>elements associated with the control, fromElementInternals.labels: each<label for>that names itsid, and a<label>around it. Nothing changes for existing code. #213 - Clicking a form control's outside label now does what it does for a native control, whether it's a
<label for>that names the control'sidor a<label>around it. Checkbox and Switch toggle, File Drop opens its file picker, and every other control takes focus. Before, Checkbox and Switch were focused without toggling, and Select, Listbox, Radio Group, Checkbox Group and Rating did nothing. A control's accessible name still comes from its ownlabelattribute. Nothing else changes for existing code. #215 - Select and Combobox have a
showPicker()method, as Date Picker and Date Range Picker do. It opens the listbox, and like a native select's or input's, it throws a "NotAllowedError" when it isn't called from a user gesture, such as a click or a key press, and an "InvalidStateError" while the component is disabled, or while a Combobox is read-only. To open one from code without a user gesture, callshow()or setopen. #209 - Slider and Range Slider have
stepUp(count?)andstepDown(count?)methods, as a native range input does. They step the value bysteptimescount, which is 1 when left out, keep it tominandmax, and dispatch no "input" or "change". Slider's throw anInvalidStateErrorwhenstepis "any", as a range input's do. Range Slider's take the thumb to step as a second argument, "start" or "end", and step the thumb that has focus, or the start thumb, when it's left out. A thumb stops at the other thumb, as it does with the keyboard. #210 - Text Field, Textarea, Search Field and Password Field have
selectionStart,selectionEndandselectionDirectionproperties and asetRangeText()method, as a native input and textarea do, beside theselect()andsetSelectionRange()they already had. Each works on the input or textarea inside, so it behaves as a native one:setRangeText()updatesvalueand dispatches no "input" or "change", and on a Text Field withtype="email"the properties arenull, and setting them,setSelectionRange()andsetRangeText()throw an "InvalidStateError", as on an email input. Nothing changes for existing code. #214 - Menu, Context Menu, Select, Combobox, Tooltip and Hover Card have a
toggle(force?)method, as Popover and Navigation Menu Item do. Like a native popover'stogglePopover(), it opens the component when it's closed and closes it when it's open,trueonly opens it andfalseonly closes it, and it returns whether the component is open afterward. It returnsfalsewhen the component stays closed, such as while it's disabled or when a "beforetoggle" listener cancels opening. Context Menu opens below whatever in its target has focus, andtoggle(true)leaves an open one where it is. #207
-
1.0.0
What's new in 1.0.0 A stable API: typed events for every framework, custom states in the manifest, and validity, read-only fields and opening from code where they were missing.All 41 changes
Slab 1.0.0. The API is stable: from here, nothing is removed without a deprecation first, and a deprecated API lasts until the next major version. Every change since 0.1 that can break something, and what to change for each, is in Upgrade to 1.0. #134
This 1.0 release is dedicated to my childhood friend, Doug Miller. We were friends for 30 years. He got me into web development and open source software. He lost his battle with melanoma last year. Today is his birthday. So I dedicate this to him. Rest in peace, buddy. I love and miss you.
If you'd like to remember Doug too, please consider a donation to the Melanoma Research Alliance, which funds melanoma research.
- Breaking: Checkbox Group's list of checked values moves from
valuetovalues, the way Listbox, Select, Combobox, Tags Input and Toggle Group have it.valueis now a string, the first of them, and setting it checks only that Checkbox. #104 - Breaking: Checkbox's
indeterminateis a property only, with no attribute, as on a native checkbox, and resetting its form leaves it as it is. Set it from script. #152 Breaking: Dialog, Alert Dialog, Command Palette and Drawer open the way a native
<dialog>does. The newshowModal()opens them as a modal.show()and settingopenopen them non-modally, so the rest of the page stays usable and Escape only closes them withclosedby. Dialog, Alert Dialog and Command Palette used to open as a modal from either. #151For a modal opened declaratively, as a framework that binds
opendoes, add the newmodalattribute:<slab-dialog modal open>opens asshowModal()does. A native<dialog>has nomodal, so it's Slab's own. Otherwise, callshowModal()where you calledshow()for a modal.- Breaking: Grid List's
selection-modeis replaced byselectableandmultiple, the samemultipleas Listbox, Select, Combobox and Tree.selection-mode="single"is nowselectable, andselection-mode="multiple"is nowmultiple, which makes rows selectable withoutselectable. #103 - Breaking: Password Field's show-and-hide button dispatches "reveal-change" instead of "toggle". "toggle" is the
ToggleEventthat elements withopendispatch, and Password Field's wasn't one. Readrevealedin the handler for whether the password shows. #114 - Breaking: Date Picker's and Date Range Picker's
showPicker()throw as a native input's does: a "NotAllowedError" without a user gesture, and an "InvalidStateError" while disabled or read-only. Setopento open the calendar from code. #152 - Breaking: Toast's "dismiss" can be canceled to keep the toast shown, as Alert's can. So it's now dispatched before the toast hides rather than after, and
openis stilltruein a "dismiss" listener. #116 Every element with
opennow dispatches "toggle" when it opens and closes, as aToggleEventwitholdStateandnewState: #102- Menu, Context Menu, Select and Combobox dispatch it for the first time.
- Breaking: Tooltip and Hover Card's "toggle" is now a
ToggleEventthat, like a popover's, doesn't bubble and isn't composed. Listen on the element itself rather than on an ancestor.
- The package includes an agent skill,
skills/slab, that teaches coding agents such as Claude Code, Cursor and Codex to use Slab: which component fits, its native events and methods, forms and validity, styling with::part()and:state(), and what not to do for accessibility. A reference page for each component, built fromcustom-elements.json, comes with it. Add it withnpx skills add ynotdraw/slab-elements --skill slab, or copy it fromnode_modules/slab-elements/skills/slab. LLMs and agents has more. #185 - Every attribute, property, method, event, slot and part in
custom-elements.jsonnow has a description, so editors show one on hover and each component's page fills in its API tables. Most were the ones many elements share, such aslabel,disabled, "change" and the validity methods. #115 - Combobox, Select, Menu, Context Menu, Tooltip, Hover Card, Date Picker and Date Range Picker dispatch "beforetoggle" before they open or close, as Popover does. Cancelling it while one is opening keeps it closed, and
openstaysfalse. #129 - Combobox and Tags Input have
readonly, as the other fields that take typing do. The value can't be changed, but it's still focusable and submitted and never invalid. A Combobox's listbox doesn't open, and the tags of both are text rather than buttons that remove them. #125 - Every element's custom states are now in the elements manifest as
cssStates, in each component's JSDoc as@cssstate, and on its docs page, each with what it means. A design selects them with:state(), so they're public API like parts. #124 - Slider, Range Slider, Color Picker and Editable have the validity API the other form controls do:
setCustomValidity(),setValidity(),validationMessage,willValidateandresetValidityFeedback(), with avalidity-messagepart and:state(error). Their values are never invalid on their own, so this is for rules of your own. Theirdescriptionpart is now a<div>around the description slot and the validity message, as on Text Field, rather than the slot itself. #126 - Dialog, Drawer, Alert Dialog and Command Palette have
requestClose(returnValue), as a native<dialog>does. It dispatches a cancelable "cancel" and closes only when that isn't canceled. #133 - Dialog, Drawer, Alert Dialog, Command Palette and Toast dispatch "toggle" when they open and close, as a
ToggleEventwitholdStateandnewStatethat doesn't bubble, so every element withopennow does. #123 - Editable dispatches "input" just before "change" when a committed edit changes its value, as a native
<select>does, so it fires both events like every other field. It still doesn't dispatch "input" while typing, becausevalueonly changes when an edit is committed. #137 - The package includes editor data, so editors autocomplete Slab's tags in plain HTML, with each attribute's values and a description on hover, and its
::part()and:state()names in CSS. WebStorm and the other JetBrains editors readweb-types.jsonon their own. For VS Code, addslab-elements/dist/vscode.html-custom-data.jsontohtml.customDataandvscode.css-custom-data.jsontocss.customData, as Get started shows. #191 - Types for using Slab's elements in React, Svelte 5 and Vue templates. Import your framework's once, such as
import type {} from 'slab-elements/react.js', and every tag's properties are checked.SlabElementPropsinslab-elements/jsx.jslists them for any other framework. #109 custom-elements.jsonand the React, Vue and Svelte types list the "invalid" event on each of the 25 form controls that validate, as a native control has it. It was dispatched all along, but no element listed it. #138- Rating has
readonly, for showing a rating that can't be changed. It's still focusable and submitted with its form, and it doesn't preview a value under the pointer. #117 - Combobox, Tooltip and Hover Card have
show()andhide(), as the other elements withopendo. Tooltip's and Hover Card's skipopen-delayandclose-delay, and Hover Card'shide()gives focus in the card back to its anchor, as Escape does. #128 - Slider has
valueAsNumber, like Number and a native range input, for itsvalueas a number.valuestays a string, as a native input's is. #105 - Copy Button, Hover Card, Steps Step, Toggle Button, Toggle Group and Tooltip match
:state(disabled)while they're disabled, as every other element withdisableddoes. #136 - Dialog, Drawer, Alert Dialog, Command Palette, Date Picker, Date Range Picker, Disclosure, Popover and Navigation Menu Item match
:state(open)while they're open, as every other element withopendoes. #135 - Toggle Group has
disabled, which disables every button in it, as Checkbox Group and Radio Group's do. #106 - The framework types now type each element's events. In React 19 and Svelte, a handler such as
oncopy-errororonchangegets the event, typed as the element dispatches it, with the element as itscurrentTarget, and Vue checks@copy-errorthe same way.slab-elements/jsx.jsaddsSlabElementEvents, every tag's events, andSlabEventHandler, for any other framework. #127 - Calendar tells screenreaders which day is picked without
range, as it already did withrange, since a focused day's selection changing isn't read out on its own.selectedLabelchanges what they're told. #174 - Command Palette tells screenreaders the text slotted into
emptyonce typing pauses with nothing matching. Before, it was put in a status region, which neither VoiceOver in Safari nor in Chrome read out when the slot was filled. Itsemptypart is no longer a status region. #176 A form control's form data and validity are current as soon as its value changes, as a native control's are, whether the user changed it or code did. Before, they trailed by an update: #146
- Inside Radio Group's "input" and "change",
valueand the form data were the previous choice, with both the old Radio and the new onechecked. Inside Checkbox Group's "input",value,valuesand the form data were the previous ones. - Inside "input", and sometimes "change",
new FormData(form)had the previous value for Checkbox, Switch, Text Field, Textarea, Search Field, Password Field, Number, Pin Input, Slider, Range Slider, Rating, Editable, Color Picker, Date Field, Date Range Field, Time Field and File Drop, andvaliditycould be stale too. - Setting
value,valuesorcheckedfrom code, on a control or on a Radio or Checkbox in a group, leftnew FormData(form)andvalidityas they were until the next update. - In Date Range Field,
validitydidn't follow when one date moved the other's bound.
setCustomValidity('')on Checkbox, Switch, Rating, Radio Group, Checkbox Group, Combobox, Listbox, Select and Tags Input now clears only the custom error, as it does natively, so a required control that's still empty stays invalid withvalueMissing. Before, it made the control valid, and once a message had been set, the control stopped validating itself at all.- Inside Radio Group's "input" and "change",
- The published package no longer asks for Node 20 and pnpm 12. Those were for working on Slab itself, and a project that installs it with npm, Yarn or an older pnpm no longer gets an engines warning or, with
engine-strict, an error. #118 - The protected hooks that Slab's own subclasses override, such as Dialog's
renderContent()and Date Field'srenderControl(), are left out of the published types andcustom-elements.json. They were never documented and aren't public API, so they can change without a major version. Subclass an element to setstyles, as the docs show. #110 - Password Field, a Text Field whose
typeis "password", and a masked Pin Input no longer have their value restored by the browser after navigating back or restoring a session, as a native password input doesn't. Neither does a Text Field or Pin Input withautocomplete="off". #153 - The published
custom-elements.jsonno longer lists the "private-*" events Slab's elements dispatch to each other, or the read-onlyversionattribute, so editors and framework tooling stop suggesting them. #108 - Select tells screenreaders which Option typing selects while it's closed, as a native
<select>does. Before, the Select's text changed without anything being read out. #173 - Importing an element on a server, as Next.js, Astro and SvelteKit do while rendering a page, no longer throws "window is not defined". The elements still render in the browser. #107
- Popover's and Navigation Menu Item's
toggle(force)takeforceand return whether they're open, as a native popover'stogglePopover(force)does.trueonly opens, andfalseonly closes. #152 - Every element's
versionproperty and attribute are marked internal, so they're out of the published types,custom-elements.jsonand the framework types. They're still there at runtime, for seeing which Slab registered an element, but they aren't public API. #119 - Elements no longer pull Slab's whole
package.jsoninto your bundle to read the version. That was about 9 KB before compression, shared by every element you imported. #101 - Listbox, Combobox, Select, Command Palette, Menu, Context Menu and Tree now tell VoiceOver which item is active in Safari. Safari doesn't pass
aria-activedescendanton to VoiceOver when it's set as an element reference, which is the only way to point from a shadow root at slotted items, so arrowing through them was silent. In WebKit, the active item is now announced as it changes, with "selected" when it is, as React Aria does on Apple devices. #177
-
0.3.1
What's new in 0.3.1 Eight new components, from Table to Date Range Picker, submenus in Menu, and Listboxes of thousands of Options.- Table
- Alert Dialog
- Toggle Button
- Grid List
- Date Picker
- Search Field
- Date Range Picker
- Sortable List
All 11 changes
- Adds Alert Dialog,
slab-alert-dialog: a modal Dialog withrole="alertdialog"for a question that needs an answer, such as confirming a delete. It has a built-in Cancel button that focus starts on, adescriptionthat's read with the label, and no light dismiss. Change the Cancel button's text withcancel-label, or withalertDialogCancelinregisterStrings(). #86 - Adds Date Picker,
slab-date-picker: a Date Field with a button that opens a Calendar in a popover, so the picker looks and works the same in every browser and can be styled. Pick a day with the mouse or keyboard, or open it with Alt+ArrowDown from the input. #88 - Adds Date Range Picker,
slab-date-range-picker: a Date Range Field with a button that opens a range Calendar in a popover, so the start and end are picked in one calendar that looks and works the same in every browser and can be styled. Open it with the button or with Alt+ArrowDown from either input. #96 - Adds Grid List,
slab-grid-listandslab-grid-list-item: a list of rows that can hold their own buttons, links and checkboxes, like React Aria's GridList. Tab reaches it once, Up and Down move between rows, Left and Right move between a row and its controls, and Escape goes back to the row. Setselection-modeto"single"or"multiple"to select rows with a click, Space or Enter. #98 - Hover Card points its anchor's
aria-detailsat the card's content, so a screenreader can tell there's more about the anchor, and has alabelattribute that makes the card a group named by it. #90 - Menu has submenus. Put a
slab-menuinside another with aslab-menu-itemas its anchor, and it opens beside that Menu Item. The Right arrow, Enter, Space, a click, or resting the pointer on the Menu Item for a moment opens it. Left and Escape close it and return focus to its Menu Item, and a click on any Menu Item in it closes every Menu. In a right-to-left page, Left and Right swap. #97 - Adds Search Field,
slab-search-field: a native search input with a button that clears it, and Escape that clears it in every browser. It's form-associated like Text Field. #87 - Adds Sortable List,
slab-sortable-listandslab-sortable-list-item: a list the user puts in order by dragging each item's handle, or with Space, the arrow keys, Home and End. Screenreaders are told where an item is as it's picked up, moved, dropped or put back. #89 - Adds Table,
slab-table, withslab-table-head,slab-table-body,slab-table-foot,slab-table-row,slab-table-column-headerandslab-table-cell: a table that components can render rows and cells into, laid out like a native<table>with the same roles. AsortableColumn Header is a button that sorts its column, setsaria-sort, dispatches "sort" and tells screenreaders how the column is sorted. Change what they're told withtableSortedinregisterStrings(). #94 - Toggle Button is new: a native
<button>witharia-pressed, for one setting that's on or off, such as Bold or Mute. A click, Space or Enter presses it or releases it. #85 Listbox and Combobox have a
virtualattribute for lists of thousands of Options. Only the Options in or near view are laid out, with spacers in place of the rest, while the keys, typeahead, filtering and selection still reach every Option. Rendered Options getaria-posinsetandaria-setsize, and the active one stays in the accessibility tree when it's scrolled away from. #99Listbox and Combobox are also much faster with long lists whether or not they're virtual: they no longer do work for every Option each time one of them connects or changes, which made a thousand Options take seconds to appear.
-
0.3.0
What's new in 0.3.0 Values screenreaders read the way you mean them, headings in Disclosure, dialogs in Popover, and the rest of the accessibility audit.All 14 changes
- Splitter's separator holds a visually hidden range input, which is what's focused and what screenreaders read, so screenreaders on phones can move it with a swipe up or down. The separator is no longer a
[role=separator]itself, so screenreaders read it as a slider, and since it isn't focused, it doesn't match:focus-visible: style its focus ring through its newfocus-visiblepart, as in::part(separator focus-visible). #68 - With
range, Calendar tells screenreaders when the first day picked starts the range, and what the range is once the last is picked. Change what it says withrangeStartedLabelandrangeSelectedLabel. #74 - The styled Checkbox's box is 24 pixels square rather than 22, the smallest target size WCAG 2.5.8 allows. #71
- Color Picker's
area-thumb,hue-thumbandalpha-thumbparts are listed in the elements manifest again, so editors and the docs show them. #70 - Command Palette tells screenreaders how many Options are left once typing pauses, the way Combobox does. Set
resultsLabelto change what it says. With none left, what's slotted intoemptyis announced instead, as before, or "No results" when nothing is. #72 - Disclosure has a
heading-levelattribute that makes its label a heading of that level, as the APG's accordion puts each header in one. #75 - File Drop tells screenreaders what a drop did: how many files were added, how many were left out for not matching
accept, and when a drop of several files was ignored withoutmultiple. Change what it says withaddedLabel,notAcceptedLabelandtoo-many-label. #73 - Meter has a
formatValueproperty, a function of the value whose result screenreaders read instead of the bare number, such as "3 of 5 GB". #79 - Popover has a
labelattribute that makes it a non-modal dialog named by the label, witharia-haspopup="dialog"on its anchor, for a popover that holds a form or controls rather than a few words. #76 - Progress has a
formatValueproperty, a function of the value whose result screenreaders read instead of a percentage, such as "3 of 10 files". #80 - Range Slider has a
formatValueproperty, a function of a thumb's value whose result screenreaders read instead of the bare number, such as "$40". #78 - Range Slider's
startandendparts are listed in the elements manifest again, so editors and the docs show them. #69 - Rating has a
formatValueproperty, a function of each radio's number that names it, such as "3 stars" rather than "3". #81 - Slider has a
formatValueproperty, a function of the value whose result screenreaders read instead of the bare number, such as "$40". #77
- Splitter's separator holds a visually hidden range input, which is what's focused and what screenreaders read, so screenreaders on phones can move it with a swipe up or down. The separator is no longer a
-
0.2.0
What's new in 0.2.0 Ten new components, from Command Palette to Feed, translations, and an accessibility pass over the rest.- Command Palette
- Hover Card
- Navigation Menu
- Tags Input
- Editable
- Date Range Field
- Copy Button
- Password Field
- Steps
- Feed
All 27 changes
- Color Picker's thumbs each hold a visually hidden range input, which is what's focused and what screenreaders read, so screenreaders on phones can adjust them with a swipe up or down. The area has a second one for its brightness, "Brightness" after
label, left out of the tab order. The thumbs are no longer[role=slider]s themselves, and since they aren't focused, they don't match:focus-visible: style a thumb's focus ring through its newfocus-visiblepart, as in::part(hue-thumb focus-visible). #63 - Range Slider's thumbs each hold a visually hidden range input, which is what's focused and what screenreaders read, so screenreaders on phones can adjust them with a swipe up or down. The thumbs are no longer
[role=slider]s themselves, and since they aren't focused, they don't match:focus-visible: style a thumb's focus ring through its newfocus-visiblepart, as in::part(start focus-visible). #62 - Combobox now tells screenreaders how many Options are left once typing pauses ("No results", "1 result", "3 results"), and which tag was removed when
multipleis set. Before, filtering and removing a tag happened silently. Both messages can be replaced, throughresultsLabelandremovedLabel. #61 aria-*attributes on a component's host now reach the element a screenreader reads, such as Text Field's<input>or Disclosure's<summary>, in Checkbox, Color Picker, Combobox, Date Field, Disclosure, File Drop, Number, Pin Input, Range Slider, Slider, Switch, Text Field, Textarea and Time Field. Before, anaria-labeloraria-describedbyyou put on the host went unread, and so did the description Tooltip gives its anchor and thearia-expandedPopover and Menu give theirs when the anchor was one of these. ID references, such asaria-describedby, are resolved where the host is and kept in step as they change. #52- Carousel's
autoplayno longer rotates when the user prefers reduced motion, and it stops for good once focus moves into the carousel, as the APG's carousel does, rather than starting again when focus leaves. The rotation button starts it in either case. #53 - Adds Command Palette,
slab-command-palette: a modal search for commands. It's Dialog, with a Combobox's<input role="combobox">and a listbox of slotted Options inside, so it has Dialog'sopen,show(),close(),closedby, label, focus trap and "cancel" and "close". Opening it empties the input and focuses it. Typing filters the Options byfilter, a case-insensitive substring of their text by default, and makes the first match active, so Enter runs the best one. Up and Down move the active Option. Enter or a click closes the palette with the chosen Option'svalueasreturnValue. A Close button beside the input closes it without choosing, which matters on phones whereclosedby="any"isn't supported, and thecloseslot changes what it says. Closing it any way other than choosing leavesreturnValueempty.queryis what's been typed, and the input's "input" leaves the host, for fetching results as the user types. When nothing matches, the listbox is hidden, the host matches:state(empty), and theemptyslot is shown in a status region. Style it through::part(dialog),::part(label),::part(input),::part(close),::part(listbox)and::part(empty). #45 - Adds Copy Button,
slab-copy-button: a native<button>that writes text to the clipboard when it's pressed. It copiesvalue, or, withfrom, thevalueor rendered text of the element with thatidat the moment it's pressed, so a code block or an input can be copied without keepingvaluein step. Once copied,copied-label("Copied") is announced from a status beside the button, the host matches:state(copied)forfeedback-duration(2000ms by default), and "copied" is dispatched. When the clipboard refuses, as it does in a page that isn't served securely,failed-labelis announced, the host matches:state(failed), and "copy-error" is dispatched instead. Style it through::part(button),:state(copied)and:state(failed). #42 - Adds Date Range Field,
slab-date-range-field: two native date inputs, a start and an end, for picking the first and last days of a range. Each input's bound is the other's value, so a browser's picker won't offer an end before the start, and an end typed before it israngeUnderflowandrangeOverflow, as a date outsideminandmaxis on a single input.start-valueandend-valueare ISO "yyyy-mm-dd" strings, and the form gets both undername, the start and then the end. The group is named bylabel, and each input by it andstart-labelorend-label, "Start" and "End" unless you set them. Style it through its parts and:state(disabled),:state(error),:state(readonly)and:state(required). #36 - Adds Editable,
slab-editable: text that's edited in place, such as a title or a name. It's a native button showing the value, named bylabeland then the value, that becomes a native input when it's pressed, with the text selected. Enter commits what's typed and Escape discards it, and both put focus back on the button. Moving focus away commits it too.valueis the last committed value, and it's what the form gets undername. "change" is dispatched when an edit is committed with a different value.edit(),commit()andcancel()do what the keys do, andeditingsays which is showing. While it's empty, the button showsplaceholder. Style it through::part(preview),::part(input),::part(label)and::part(description), and:state(disabled),:state(editing)and:state(empty). #41 - Adds Feed,
slab-feed: the APG's feed, a[role=feed]of articles that grows as the user scrolls, like a timeline. Each slotted element is an article, put in the tab sequence and givenaria-posinsetandaria-setsize, so a screenreader says where it is. It's a[role=article]unless it's an<article>or has a role, and it's named by its first heading unless it has a name. Page Down and Page Up move focus to the next and previous article from anywhere in one, and Control+End and Control+Home move focus to what's after and before the feed. Loading is yours: add articles and setbusywhile you do.totalis how many articles there are in all, or -1 when that's unknown, and the number there are now when unset. The feed is named bylabel. Style it through::part(feed). #40 - Field now describes its control by what's slotted into
description, through the control'saria-describedby, after any IDs it already has, and sets the control'saria-invalidwhileerroris set. Before, a screenreader read neither the hint nor the error, nor that the control was invalid. #54 - Color Picker keeps the colors being picked from in forced colors, such as Windows' contrast themes. Before, the browser painted the area, the hue and alpha sliders and every swatch in the user's background color, so there was nothing to pick from. #51
- Checkbox Group and Radio Group now tell screenreaders when they're invalid. Radio Group sets
aria-invalidon its radiogroup. A group role can't takearia-invalid, so Checkbox Group sets it on each of its Checkboxes instead. Both follow the Group's validity feedback, so they're marked once its validity is reported and cleared once it's valid. #56 - Adds Hover Card,
slab-hover-card: a preview of what a link leads to, slotted beside itsanchorin a native[popover]in the top layer. It opens when the anchor is hovered or focused by keyboard, afteropen-delay(700ms by default), and closes when the pointer leaves, afterclose-delay(300ms), when focus leaves it, and on Escape. Unlike Tooltip's, its content can hold links and buttons, which follow the anchor in the focus order, so Tab moves into the card. A touch doesn't open it.placementpicks the side it opens on, and it flips when there's no room. Style it through::part(card)and:state(open). #35 - Text Field, Number, Pin Input and Combobox now leave Enter to an input method while it's composing, such as one for Japanese or Chinese. Before, the Enter that confirms a conversion submitted the form, or chose the active Option in Combobox. Safari's composition-ending Enter, which doesn't set
isComposing, is recognized too. #48 - Menu Item has a
typeofcheckboxorradio, which makes it amenuitemcheckboxormenuitemradiowitharia-checked,checked, and:state(checked). A click checks it before any "click" listener hears it. The new Menu Group,slab-menu-group, is a named[role=group]for a set of radio Menu Items in a Menu or Context Menu. Its Menu Items are still the Menu's, so the arrow keys and typeahead move through them as through the rest. #58 - Adds Navigation Menu,
slab-navigation-menu, and Navigation Menu Item,slab-navigation-menu-item, for a site's navigation. It's the APG's disclosure navigation rather than a[role=menu]: a<nav>named bylabel, around a<ul>with an<li>for each link and Item. Each Item is a<button>witharia-expanded, named by itslabel, that shows and hides a list of links of its own. Opening one Item closes the others, and Escape, a click outside an Item, or focus leaving it closes it. Tab goes through every link and button. Left and Right move along the row, Down on an Item's button opens it at its first link, and Up and Down move between its links. An Item's content is in the flow below its button, anddisplay: nonewhile closed, so a design positions it. Items haveopen,show(),hide(),toggle()and a "toggle" event. Style them through::part(nav),::part(list),::part(item),::part(trigger)and::part(content). #38 - The new Option Group,
slab-option-group, is a named[role=group]of Options for Listbox, Select and Combobox. Its Options are still the Listbox's, Select's or Combobox's, so the arrow keys, typeahead and selection work across groups as across the rest. Combobox hides an Option Group while its filter hides every Option in it. #59 - Adds Password Field,
slab-password-field: a native password input with a button that shows and hides the password. The button is a toggle button named bytoggle-label("Show password" by default) whosearia-pressedfollowsrevealed, and it fires "toggle" when pressed. While the password shows the input is a text input, with spellcheck, autocorrect and autocapitalize off.revealedworks likevalue, so the attribute is the default and a form reset hides the password again. It's form-associated with Text Field's API:required,minlength,maxlength,pattern,autocomplete,setCustomValidity(),setValidity()and a validity message. Style it through::part(control),::part(input),::part(toggle-button)and:state(disabled),:state(error),:state(readonly),:state(required)and:state(revealed). #44 - Left and Right now follow the reading direction in Tabs, Toolbar, Toggle Group, Radio Group, Menubar, Tree, Calendar, Color Picker's swatches and Combobox's tags. In a right-to-left page, Left moves to the next item, as it does for native radios, Tree expands with Left and collapses with Right, Calendar moves forward a day with Left, and Combobox moves from the start of its input to its tags with Right. #49
- A click on Select's or Listbox's label now focuses it, as a click on a native select's label does. Nothing happens while it's disabled. #60
- Adds Steps,
slab-steps, and Step,slab-steps-step, for showing where the user is in a task of several steps, such as a checkout or a setup wizard. It's an<ol>named bylabel, with an<li>for each Step. The Steps beforestepare complete, the one at it is current and hasaria-current="step", and the rest are upcoming. Past the last Step, every one is complete. Each Step shows its number, its label from the default slot, and adescriptionslot, and a complete one hascomplete-label("Completed" by default) after its label, hidden visually, for screenreaders. Withnavigable, each Step is a<button>, and clicking one setsstepand dispatches "change";disabledkeeps the user off Steps they can't go to yet.next()andprevious()move it along from your own buttons. Style it through::part(list)and::part(item), and each Step through::part(step),::part(indicator),::part(label),::part(status),::part(description)and:state(complete),:state(current),:state(upcoming)and:state(navigable). #43 - Adds
registerStrings(), fromslab-elements/strings.js, for translating the words Slab's elements say on their own, such as Alert's "Dismiss", Pagination's "Page 3" or Carousel's "Next slide". An element uses the strings registered for its nearestlang, then for that language without its region, and then English. An attribute or property set on the element still wins. Calendar also numbers its days in its language's digits, such as Arabic-Indic ones underlang="ar-EG". #64 - Switch now shows when it's invalid, the way Checkbox does. Before, a required Switch left off blocked submission without saying why. Once its validity is reported it sets
aria-invalidand:state(error)and shows avalidity-messagepart, worded by the browser unless you give it one. It also hasvalidationMessage,willValidate,setCustomValidity(),setValidity(), andresetValidityFeedback(). #55 - Adds Tags Input,
slab-tags-input: a native text input that turns what's typed into tags, for values with no list to pick from. Enter adds what's typed as a tag, and so does typingdelimiter(a comma by default), so a pasted list becomes several tags. Tags are trimmed and not repeated,maxcaps how many the user can add, and what's typed is added when focus leaves. Each tag is a<button>that removes it, named byremoveLabel, and the keyboard is Combobox's withmultiple: Backspace in an empty input removes the last tag, and Left moves to the tags.valueslists the tags, each submitted as its own entry, and thevalueattribute is the starting tags separated by commas. It's form-associated, withrequired,setCustomValidity(),setValidity()and a validity message. Style it through::part(tag),::part(tags),::part(input)and:state(disabled),:state(empty),:state(error),:state(full)and:state(required). #37 - Toast no longer dismisses itself on a timer when it has something to act on, such as an Undo button or a link, whatever
durationsays (WCAG 2.2.1). F6 now moves focus to the open toast shown most recently, and F6 from inside it moves focus back, as react-aria's toasts do. Dismissing a toast with focus in it moves focus back too. #57 - Text Field, Textarea, Number, Date Field, Time Field, File Drop, Checkbox, Checkbox Group, Radio Group, Listbox, Select, Combobox, Rating and Pin Input now show the browser's own validity message, in the browser's language, when one fails a built-in constraint and you haven't given it a
validity-message. Before, a required field left empty was invalid but said nothing, so a screenreader user wasn't told why the form wouldn't submit. Each also hasvalidationMessageandwillValidate, as a native control does. #50
-
0.1.3
What's new in 0.1.3 Nine new components, from Menubar to Color Picker, and ranges of days in Calendar.- Menubar
- Context Menu
- Carousel
- Color Picker
- Rating
- Pin Input
- Splitter
- Range Slider
- Time Field
- Calendar ranges
All 11 changes
- Adds
rangeto Calendar,slab-calendar, to select a range of days rather than one. The first day picked starts the range and the second ends it, in either order, and "change" is dispatched once both are.valueis then the range as "yyyy-mm-dd/yyyy-mm-dd", the ISO 8601 form of an interval. While the range is being picked, the days from the first to the one focused or hovered are::part(preview), and Escape starts over. The range's days are::part(selected)and its ends::part(range-start)and::part(range-end), and the grid isaria-multiselectable. #18 - Adds Carousel,
slab-carousel: a region of slides, following the APG carousel pattern. The slides are a CSS scroll snap container, so swiping, scrolling and the arrow keys move between them natively in every browser. Previous and Next, a marker per slide, and a rotation button whenautoplayis set are real buttons, rather than the::scroll-button()and::scroll-markerpseudo-elements only Chromium has, so they're named and styled the same everywhere.indexis the current slide's,loopwraps Previous and Next, andautoplaymoves on everyintervalmilliseconds, pausing while the carousel is hovered or focused. Slides out of view areinert. Style it through its parts and:state(first),:state(last)and:state(rotating). #25 - Adds Color Picker,
slab-color-picker: a saturation and brightness area, a hue slider, an alpha slider withalpha, a hex field, and swatches fromswatches. The area and the sliders are[role=slider]s, stepped with the arrow keys, Page Up and Page Down, and Home and End, or dragged, and the swatches are a listbox whose selection follows focus.valueis a lowercase "#rrggbb", or "#rrggbbaa" withalpha, and the form gets it undername. Style it through its parts,:state(disabled)and:state(dragging), and the--color-picker-hue,--color-picker-opaqueand--color-picker-valuecustom properties it sets. #27 - Adds Context Menu,
slab-context-menu: Menu's Menu Items in a[role=menu]popover that opens over whatever is slotted intotarget, in place of the browser's own menu. It opens at the pointer on a right-click or Control-click, where it was pressed on a long-press with a finger or a pen, and below what has focus on Shift+F10 or the Menu key. It's kept on screen, flipping up or back when there isn't room, and it has Menu's keyboard. Prevent the default of a "contextmenu" in part of the target to keep it from opening there. Style it through its parts and:state(open). #26 - Adds Menubar,
slab-menubar: a row of Menus, such as File, Edit and View, following the APG menubar pattern. Each Menu's anchor becomes a[role=menuitem]in a[role=menubar]with a rovingtabindex, so Tab reaches it once and Left, Right, Home and End move between the anchors. While a Menu is open, Left and Right close it and open the one beside it, and pointing at another anchor does the same. Opening, closing and moving through each Menu's items is Menu's own. Style it through::part(menubar). #22 - Adds Pin Input,
slab-pin-input: a PIN or one-time code field as a row of native inputs, one per character, that reads and submits as one value. Typing moves to the next input and Backspace moves back. A pasted or autofilled code, such as one offered byautocomplete="one-time-code", is spread across the inputs, with separators like "-" left out.lengthsets how many characters,type="alphanumeric"accepts letters as well as digits, andmaskhides them. An empty required field isvalueMissingand a partly filled onetooShort, and "complete" is dispatched when every input is filled. Style it through its parts and:state(complete),:state(disabled),:state(error),:state(readonly)and:state(required). #24 - Adds Range Slider,
slab-range-slider: a two-thumb slider for picking a range, following the APG multi-thumb slider pattern. Each thumb is a[role=slider]bounded by the other, so they can meet but not pass.start-valueandend-valueare the range, clamped tominandmaxand snapped tostep, and the form gets both undername. Drag a thumb, press the track to bring the nearer one there, or use the arrow keys, Page Up and Page Down, and Home and End. Style it through its parts and:state(disabled)and:state(dragging). #17 - Adds Rating,
slab-rating: a row of native radios, one for each point from 1 tomax(5 by default), in a[role=radiogroup]named bylabel.valueis the checked radio's number, and the form gets it undername. Withstep="0.5", there are two radios to a star, one for each half, which are::part(start)and::part(end). It's form-associated, withrequired,setCustomValidity(),setValidity()and a validity message, as on Radio Group. Each radio is::part(star), and those up to the value are::part(filled)too. While the pointer is over a radio, those up to it arefilledinstead, and the host is:state(previewing). Style it through its parts and:state(disabled),:state(error),:state(previewing)and:state(required). #23 - Splitter's separator no longer scrolls the page when it's dragged in Safari on iOS. It cancels "touchstart" while it isn't disabled, since
touch-action: nonealone doesn't stop the scroll there. #19 - Adds Splitter,
slab-splitter: two panes, in its "primary" and "secondary" slots, with a[role=separator]between them that resizes them, following the APG window splitter pattern. Drag the separator, or move it with the arrow keys bystep, Home and End tominandmax, and Enter to collapse the primary pane and restore it.valueis the primary pane's share as a percentage, andorientation="horizontal"stacks the panes. Style it through its parts and:state(collapsed),:state(disabled)and:state(dragging). #15 - Adds Time Field,
slab-time-field: a time field around a native<input type="time">, with the same API as Date Field. Its value is a 24-hour "hh:mm" string whatever clock the browser shows, andmin,max,stepandrequiredvalidate the way they do on the input, including amaxearlier thanminfor a range across midnight. #14
-
0.1.2
- Combobox takes
multiple. Each selected Option is shown before the input as a tag, a button that removes it, and choosing an Option toggles it and leaves the listbox open. Backspace in an empty input removes the last tag, and Left at the start of the input moves to the tags.valuesreads and sets every selected value, in the order they were chosen, and each is submitted as its own entry, as a<select multiple>submits them. Style the tags with::part(tag)and::part(tags), and name their buttons withremoveLabel. #11 - Adds Toggle Group,
slab-toggle-group, and itsslab-toggle-group-button: a row of toggle buttons that Tab reaches once and the arrow keys move between. One button is pressed at a time, or several withmultiple. Setpressedon a button that starts out pressed; the group handlesaria-pressed.valueandvaluesread and set which are pressed. #9
- Combobox takes
-
0.1.1
- The package now includes its custom elements manifest. Tools that read
"customElements"frompackage.json, such as IDE plugins, Storybook and linters, can find every component's attributes, properties, events, slots, CSS parts and custom properties. It's atslab-elements/custom-elements.json. #5
- The package now includes its custom elements manifest. Tools that read
-
0.1.0
- The first release: 32 headless Web Components, each built on a native element, with keyboard and focus handling, ARIA, form participation and events, and no visual styles. Style them with
::part()and:state(), or subclass them and setstyles. See slab-elements.dev to get started.
- The first release: 32 headless Web Components, each built on a native element, with keyboard and focus handling, ARIA, form participation and events, and no visual styles. Style them with