IDs to add to the inner control's aria-describedby: the hint, then the shown message.
checkValidity()
True when the value is valid; otherwise fires invalid and returns false, like native.
reportValidity()
Like checkValidity(), and also shows the browser's validation message when invalid.
setCustomValidity(message)
Set (non-empty) or clear (empty string) a custom validation error, like native controls.
setValidityState(flags, message, anchor)
For subclasses: set the validity flags and message. anchor is the element the browser points its message at.
validate()
Show (or clear) the error from the control's own checks: required, type, pattern, min,
max and the like. Uses error-message, else the browser's localized message. An error the
author set (a server error, say) is left as it is.
clearValidation()
Clear the error and warning that validate() and warning-pattern showed (a form reset does).
emitValue(commit)
For subclasses: fire the value events, as a native control does on a user edit: input
(bubbles, composed), then with commit also change (bubbles, stays in its tree).
idrefText(ids)
For subclasses: the text of the elements an ID reference list names, resolved in the host's
tree (ID references cannot cross a shadow root), joined by spaces.
Events
Event
Description
input
Fired on every user edit of the value.
change
Fired when the user commits a change to the value or state.
Slots
Slot
Description
(default)
Default content.
CSS parts
Style the inside of the component with ::part(), for example focsd-toggle-group::part(group).
Part
Description
group
The group element.
label
The label element.
layout
The wrapper around the label and the body.
body
The group and the messages.
hint
The hint text.
message
The shown message (also error, warning or success).
message-icon
The icon in the message.
announcer
The hidden region that announces message changes.
Accessibility
A labeled role="group" with one tab stop; arrow keys move between toggles (mirrored in right-to-left pages).
type="single" allows at most one pressed toggle; type="multiple" allows any number.
Form-associated: submits the pressed value(s) under name.
Keyboard
Key
Action
Arrow keys
Move between toggles
Home / End
First / last toggle
Enter / Space
Press the focused toggle
Ask the docs
Hi, what are you building?
Ask about any component, theming, forms or frameworks. I answer with the right component, a snippet and a link to its docs.