Components
60 elements
Every one is built on a native element, or an ARIA role when the platform doesn't have one. Each page shows a styled example next to the headless markup, so you can see what's possible — and what's yours to decide.
Overlays
- Alert <slab-alert> An inline message that gets announced when it shows up. Put it on the page empty, then fill it in when there's something to say.
- Alert Dialog <slab-alert-dialog> A modal dialog that asks before something can't be undone. Focus starts on Cancel, and a click outside doesn't close it.
-
Command Palette
<slab-command-palette>
A search for commands, opened as a modal with
showModal(): type to filter a list of Options, then Enter runs the best match. It's a Combobox in a Dialog. -
Dialog
<slab-dialog>
A dialog built on the native
<dialog>, modal or not. A modal one keeps focus inside, closes on Escape, and makes the rest of the page inert — the platform does the heavy lifting. -
Drawer
<slab-drawer>
A dialog for a side panel. Non-modal by default, so the page behind it stays usable, or modal through
showModal(). - Hover Card <slab-hover-card> A preview of what a link leads to, shown beside it on hover and keyboard focus, with room for links and buttons of its own.
- Popover <slab-popover> Content that pops up beside the element that opened it, in the top layer, and gets dismissed the way a native popover does.
- Toast <slab-toast> A polite heads-up that something just happened. It lives on the page up front, so screen readers actually hear it.
- Tooltip <slab-tooltip> A short description that shows up beside an element on hover and focus.
Disclosure
- Accordion <slab-accordion> A group of Disclosures where opening one can close the others. Great for FAQs.
- Carousel <slab-carousel> Slides one after another that swipe and snap with CSS, with Previous, Next and a marker per slide.
-
Disclosure
<slab-disclosure>
Show and hide content behind a summary. It's a native
<details>with a few extras. - Splitter <slab-splitter> Two panes with a separator between them that resizes them, dragged or moved with the keyboard.
Navigation
- Breadcrumb <slab-breadcrumb> The trail of links to the current page, as an ordered list in a navigation landmark. Separators are yours to add.
- Context Menu <slab-context-menu> Menu's Menu Items, opened where the user right-clicks or long-presses, or from the keyboard, in place of the browser's own menu.
- Menu <slab-menu> A button that opens a list of actions. It's the APG's menu button, keyboard and all.
- Menubar <slab-menubar> A row of Menus, such as File, Edit and View, with the arrow keys to move between them. It's the APG's menubar.
- Navigation Menu <slab-navigation-menu> A site's navigation: links, plus buttons that show and hide links of their own. It's the APG's disclosure navigation, not a menu.
- Pagination <slab-pagination> Buttons for moving between pages, with an ellipsis for the ones it doesn't show.
- Steps <slab-steps> Where the user is in a task of several steps, such as a checkout or a setup wizard, as a numbered list. Steps can be buttons that go back.
- Tabs <slab-tabs> Tabs and their Panels, with one Panel showing at a time.
- Toolbar <slab-toolbar> A group of controls that Tab reaches once, with the arrow keys to move between them.
- Tree <slab-tree> A nested list of items that expand and collapse, to pick one or more from.
Selection
-
Combobox
<slab-combobox>
A text input that filters a list of Options as you type, to pick one or, with
multiple, several as removable tags. - Listbox <slab-listbox> A list of Options to pick one or more from, right on the page instead of in a popup.
-
Select
<slab-select>
A button that opens a list of Options to pick one or more from. It submits just like a
<select>. - Toggle Button <slab-toggle-button> One button that stays pressed until it's pressed again, for a setting that's on or off.
- Toggle Group <slab-toggle-group> A row of toggle buttons that Tab reaches once, with one pressed at a time or several.
Form
- Checkbox <slab-checkbox> A checkbox built on the native one, with an indeterminate state and real form validation.
- Checkbox Group <slab-checkbox-group> A set of Checkboxes with one label, one value, and one validity between them.
- Color Picker <slab-color-picker> A color picker with a saturation and brightness area, hue and alpha sliders, a hex field and swatches.
- Copy Button <slab-copy-button> Copy text to the clipboard with a button, and say so once it has.
- Date Field <slab-date-field> A date field built on the native date input. The browser brings its own picker.
- Date Picker <slab-date-picker> A Date Field with a button that opens a Calendar in a popover, so the picker is the same in every browser and yours to style.
- Date Range Field <slab-date-range-field> A start and an end date, each on the native date input, linked so the end is never before the start.
- Date Range Picker <slab-date-range-picker> A Date Range Field with a button that opens a range Calendar in a popover, so both days are picked in one calendar that looks the same in every browser.
- Editable <slab-editable> Text that is edited in place, such as a title or a name: a button showing the value that becomes an input when pressed.
- Field <slab-field> A label wired up to a control of your own. Bring any input, select, or element you like.
- File Drop <slab-file-drop> A file input you can also drop files onto. One list of files, either way.
-
Form
<slab-form>
A
<form>that Slab's controls submit, reset, and validate with — just like native ones. - Number <slab-number> A number field built on the native one, with stepping and validation included.
- Password Field <slab-password-field> A password input with a button that shows and hides what was typed.
- Pin Input <slab-pin-input> A PIN or one-time code field: a row of native inputs, one per character, that submits as one value.
- Radio Group <slab-radio-group> A set of Radios with one label, one value, and exactly one checked.
- Range Slider <slab-range-slider> A two-thumb slider for picking a range, with a thumb at each end that can meet but not pass the other.
-
Rating
<slab-rating>
A row of native radios from 1 to
max, with one label and one value, that previews the value under the pointer. - Search Field <slab-search-field> A search input with a button that clears it, and Escape that does the same.
- Slider <slab-slider> A single-thumb slider built on the native range input.
- Switch <slab-switch> An on and off toggle built on a native checkbox with the switch role.
- Tags Input <slab-tags-input> A text input that turns what you type into removable tags, for values with no list to pick from, submitted one entry per tag.
- Text Field <slab-text-field> A single-line text field built on the native input, validation and all.
- Textarea <slab-textarea> A multi-line text field built on the native textarea.
- Time Field <slab-time-field> A time field built on the native time input. The browser shows a 12- or 24-hour clock for the locale.
Data
-
Calendar
<slab-calendar>
A month of days to pick from, or with
range, a range of them. It's the grid from the APG's date picker, with all the keyboard support you'd expect. - Feed <slab-feed> A list of articles that grows as the user scrolls, like a timeline. Page Down and Page Up move between articles, and a screenreader hears where each one is.
- Grid List <slab-grid-list> A list of rows that can hold their own buttons, links and checkboxes, moved through with the arrow keys and optionally selected.
- Meter <slab-meter> A measurement in a known range, like disk usage. It tells you which region the value's in, so your design can show it.
- Progress <slab-progress> How far along a task is, or just that it's happening when you don't know yet. That's your spinner, too.
- Sortable List <slab-sortable-list> A list the user puts in order, by dragging each item by its handle or with the keyboard, while a screenreader hears where the item is as it moves.
- Table <slab-table> Rows and columns, laid out and announced like a native table, that components can render into. Column headers can be buttons that sort.