Repository navigation
09 Ful fields
The conventions every ful-* field follows: the disabled and readonly claims, form association, validation, the change event, and the structural tags the css hooks. Once these are known, an element's behaviour follows from its attribute table alone, which is why the per-element pages list attributes and little else.
Concepts frames the same material in one page alongside the rest of the library; Extending fields is the same contract from the other side, for a field you write yourself.
disabled follows native semantics, exactly:
flowchart LR
A["disabled attribute on the field<br/>(the author's claim)"] --> C(["claim <b>or</b> ancestry"])
B["disabled <fieldset> ancestry<br/>(the platform's word)"] --> C
C --> D["matches :disabled<br/>control disabled, dimmed styling,<br/>absent from form.values"]
A -.->|"reflected by"| E[".disabled property<br/>the claim alone, never the ancestry"]
- the attribute on the field is the author's claim, and nothing but the author ever writes it.
- the effective state is the platform-composed one: claim or a disabled
<fieldset>ancestry, readable asel.matches(':disabled'). - the
disabledproperty reflects the claim only, like a native input's: a field disabled solely by its ancestry reads.disabled === false(changed in 8.0.2: askmatches(':disabled')for the effective state).
The scenarios, as with a native control:
| Scenario | Result |
|---|---|
| claim set, no disabled ancestry | disabled: matches :disabled, dimmed, absent from form.values
|
disabled <fieldset> ancestry, at any time |
disabled through the ancestry, follows the fieldset back to enabled |
| claim set before or while the fieldset is disabled, then the fieldset is re-enabled | still disabled: the claim survives, regardless of order |
| claim released while the ancestry is still disabled | still matches :disabled through the ancestry |
inside the first <legend> of a <fieldset disabled>
|
not disabled: the platform exempts the legend's children |
readonly is the same shape. The host attribute is the claim, and it reaches the inner control's native readOnly where there is one.
Where there is none, because the control has no editable text to protect, as on a checkbox, a radio group, a file field or a filter with menus, the field names a part of its own chrome as the frozen piece, and the base refuses gestures inside it while the claim holds: the checkbox does not toggle, the file picker does not open, the filter's menu does not show. The control stays focusable and readable, and the state is announced through aria-readonly on whichever element carries a role that accepts it. The value still submits either way.
Every field is a form-associated custom element wrapping a native control. The inner control carries form="", detaching it from any outer form, so the host is the single form citizen: it appears in form.elements, answers form.values extraction, and submits its name. Fields inside a ful-form are picked up automatically; fields in a plain form work too.
Attributes.forward('input-', host, innerControl) is the addressing convention: any input-* attribute on the host lands, prefix stripped, on the inner control:
<ful-input input-placeholder="MM/DD" input-inputmode="numeric" input-maxlength="10">The inner control carries form="", so the platform has nothing to implicitly submit: the base stands in for it, and every field gets the behaviour without writing a line of it. What Enter reaches is what a native form would submit from, which was measured on Chromium, Firefox and WebKit rather than read off a specification:
| Enter in | what happens |
|---|---|
ful-input, the temporal inputs, ful-select with its list closed, ful-checkbox, ful-radio-group, either operand of a compare filter |
the form submits |
ful-input type="textarea" |
a newline is inserted |
ful-input-file |
the file picker opens |
a filter's operator button, ful-filter-boolean
|
the button's menu opens |
ful-select with its list open |
the highlighted entry is accepted |
The form is submitted through its first enabled submit control, so a submit listener sees the same submitter it would have seen from a click. The numpad's Enter counts as Enter everywhere.
Two cases are deliberately left to the platform. A control you slot into a field yourself is still associated with the form, so the platform submits it and the base does not, which is what keeps it from submitting twice. A field that consumes the key, by calling preventDefault() on the keydown, owns it: nothing is submitted after that, which is how ful-select accepts an entry instead.
-
requiredmaps toaria-requiredon the inner control (nativerequiredwould double-validate). -
setCustomValidity(msg)on any field: a truthy message sets the custom error and renders it into the field'sful-field-error; falsy clears both. ful forms call it for you from the server'sproblems(see forms). -
ful-formsetsnovalidateon the inner form: the native tooltips are suppressed, validation is yours and the server's.
Announcements follow WCAG 4.1.3 by default: ful-field-error is a polite live region. A form with scroll-on-error turns the live region off while it moves focus, so each error is announced exactly once through the focused field.
Every field stops the inner control's native change and republishes it from the host: it bubbles, it is not cancelable, and its detail is { value }, carrying the same value the form extracts:
form.addEventListener('change', e => console.log(e.target, e.detail.value));Not custom elements, but style-only hooks the templates render and your css can target:
| Tag | Role |
|---|---|
ful-control-group |
the row wrapping a control and its affixes |
ful-affix |
an affix cell (icons, buttons, operator menus) |
ful-control |
a plain layout wrapper |
ful-icon |
an inline svg-mask icon (<ful-icon name="search">) |
ful-badge |
a removable value chip (multiple selects) |
ful-item-list / ful-item
|
the list of chosen files/entries under a field |
ful-field-error / ful-field-warning(s)
|
per-field error/warning targets |
ful-errors |
the global form error banner |
ful-choice |
the checkbox/switch wrapper |
ful-spinner |
the busy indicator. A style-only tag, not an element: the glyph is its own pseudo-element, the label its children |
ful-note |
the tooltip's anchored popover bubble |
ful-toast |
a toast item; whoever hosts toasts is the region |
ful-tablist / ful-accordion-group / ful-steps
|
the tabs, accordion and wizard anchors |
ful-table-wrapper / ful-pagination-bar / ful-radio-list
|
the table, pagination and radio-group anchors |
ful.css is self-contained: no bootstrap, no icon fonts, no javascript. Every element is themed through the --ful-* custom properties (density included: --ful-controls-height sizes every control uniformly), and the structural styling hooks are the style-only tags below. Focus and invalid rings derive from the accents through color-mix, and the palette is dark-mode aware through light-dark(). The full token inventory, the customization and the icon system: theming.
The l10n overlay the plugin bakes, overridable through translations:
| Key | Used by |
|---|---|
pagination.showing, pagination.previous, pagination.next, pagination.reload, pagination.navigation
|
ful-pagination |
table.initial, table.error, table.nodata
|
ful-table states |
dropdown.empty, select.remove
|
ful-select |
files.dropzonelabel, files.remove, files.unacceptablefiletype, files.maxfilesizeexceeded, files.maxtotalsizeexceeded, files.maxfilesexceeded
|
ful-input-file |
filters.op.* (one per operator), filters.sensitivity.*, filters.boolean.*
|
ful-filter-* |
info.tooltip, dialog.acknowledge, drawer.close
|
ful-tooltip, ful-dialog, ful-drawer
|
toast.region, toast.dismiss
|
ful-toasts |
wizard.progress |
ful-wizard |
See Localization for the message syntax and the override mechanism.
ftl
httpc
ful
- Getting started
- Fields
- Forms
- Inputs
- Select
- Files
- Temporal inputs
- Tables
- Disclosures
- Navigation
- Async sections
- Timing and storage
- Theming
Extending
Reference
Project