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
|
n/a | Form element with the last form-group moved to the right side. |
Top Label
|
Form sections are optional; they contain groups. Most forms are not big enough to need sections. |
Manual
|
|
(Single-input Form group) |
Single-input Form Groups contain just one form element or item of non-form content. If there is more than one input, use a Multi Group. Single-input Form Groups contain two Form Items, the first item set to type 'label' and the second item set to type 'input' (because they contain the Form Group's TYPE must match the type of the input or non-form content contained in the group. That means a form input type (text, textarea, checkbox, radio, select, etc); or one of a limited range of non-form content (expander, message, table, tree). |
Preset
Manual
Non-form contentIn this case, a single full-width message:
|
(Multi-input form group) |
As the name suggests, Multi-input Form Groups hold multiple form inputs. Because each input has its own label, the Multi input group needs to wrap the set and describe the overall purpose. To achieve that, Multi-input groups are a In all other respects they are the same as a single input group. TYPE is |
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
ManualIn this example a text input is being produced, so the TYPE is text.
|
|
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
ManualNote the group type matches the input type.
|
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
|
To offer more information about this selection, help links can be used. Help links should be placed inside the input set wrapper (as siblings of the label and input). |
|
|
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 |