Forms
ACE form API
Example | Element | Code |
---|---|---|
n/a | Base form element. If no modifier class is applied, the default is top label layout. |
Top Label
Side Label
Inline Label
|
Form sections are optional; they contain groups. Most forms are not big enough to need sections. |
Manual
|
|
(Single-input Form group) |
Form groups typically contain two form items, the first set to type 'label' and the second set to type 'input' (because they contain the label and input elements). Type can match any form input type (text, checkbox etc); and a limited range of non-form content (expander-panel, message, table, tree). |
Preset
Manual
Non-form contentIn this case, a single full-width message:
|
(Multi-input form group) |
Multi input group uses fieldset to group multiple inputs and their labels; and the legend to describe the purpose of the inputs as a whole. Multi input groups hold multiple (more than one) form inputs. In all other respects they are the same as a single input group. |
Manual
|
n/a | Form sub-item. For use within multi-group input items only. |
Manual
|
|
Single input group. This pattern works for text, textarea, select and the HTML5 text variations such as email, date, etc. |
Preset
Manual
|
|
The placeholder attribute may be used for optional, additional hints. Note that placeholders do not replace LABEL elements. The input must still be understandable without the attribute. |
Preset
Manual
|
Error text explaining what to do
|
Error state: the group and input get an error class; if there is an explanatory note it is linked to the input via the aria-describedby attribute (which matches the ID of the error message). The error message must be an accessible element, eg. by having a tabindex or aria role. |
Preset
Manual
|
Extra information about the input.
|
Info provides explanatory text for the input. This is instead or in addition to any state message. Info is also linked to the input via the aria-describedby attribute (which matches the ID of the info div). Where both exist, both values are written into aria-describedby (space-separated). |
Info element
Preset group with info element
Info element
|
|
Required fields use an ABBR element to provide alternative text. When visible, this is done via a title attribute; when the affordance is hidden it can simply be the text of the ABBR element. |
Preset
Manual
|
|
Form labels can have an icon as the first or last child element. When an icon is present, the usual label text must be enclosed in a SPAN element set to class ace-text. |
Preset
Manual
|
|
Read only inputs are set by adding the native readonly attribute, in full quoted format.. |
Preset
Manual
|
|
Disabled inputs are set by adding the native disabled attribute, in full quoted format. |
Preset
Manual
|
Assistive labels are not rendered visibly, but remain available to assistive technology. This technique should only be used where there is sufficient visual context that sighted users don't need a label. |
Text box with assistive label, using the preset:
When using the manual approach, any label can be set to assistive:
Radio buttons and checkboxes also honour the 'assistive' property:
|
|
A single checkbox is an unusual pattern, as the form input contains both the input and label; while the input container remains empty. Checkboxes can be set to checked state with the native checked attribute, in full quoted format. |
Preset
Manual
|
|
Radio button group. Note that you must not set set a radio button to both disabled AND checked. |
Manual
|
|
Multiple checkbox group. |
Manual
|
|
Where multiple inputs need to be combined within a form group, the group\'s type is always set to mixed and inline. Inline groups behave in a very similar way to inline forms. |
Manual
|
|
|
Input sizes can be overridden if required with the ace-form-field-SIZE class, although it is not recommended in most cases. Available sizes are xsmall, small, medium, large, xlarge, minwidth (smallest input allowed by design language), maxwidth (largest input allowed by design language) and fullwidth (100% width). If in doubt, just leave form inputs to their default size. |
Preset
Manual
|
n/a | Within multi-groups, label sizes can be overridden with the ace-form-label-SIZE class, although it is not recommended in most cases. Available sizes are xsmall, small, medium, large and xlarge. If in doubt, just leave form inputs to their default size. |
Manual
|
Buttons group. Can contain buttons and submits. |
Form button groupAll buttons go inside a group:
Using preset buttons:
Using manual buttons:
|
|
|
Select Element |
Manual using block:
Manual using an Array for options:
|
Toggle. Note Toggles use Multi Groups, as they are actually a radio button pair. |
|
|
|
Date picker |
|
|
Hidden-type input groups must be the first child within an ACE Form. Note this is for fields which are never displayed; set to type 'hidden'. |
|
Form groups can be conditionally shown and hidden by setting the |
|
|
Subtle Select - currently the only input that supports the 'subtle' form input variant. Used for cases where the full select style is too heavy in context. |
ASP support forthcoming. As a workaround, use |