Each form field combination of text label and form control may optionally be wrapped in
.env-form-field for consistent spacing. The form field wrapper may also contain a help text using .env-form-field-help.
<formclass="env-form"action="/"><divclass="env-form-field"><labelfor="text-1"class="env-form-label">Input text</label><inputtype="text"class="env-form-input"placeholder="Placeholder text"aria-describedby="text-1-help"id="text-1"/><pid="text-1-help"class="env-form-field-help">Form field help</p></div><buttonclass="env-button env-button--primary">Submit</button></form>
Form control container
The class .env-form-control creates a multipurpose container used to group and enhance form controls and related elements.
Common elements used inside .env-form-control include:
.env-form-label
.env-form-input
.env-button
.env-icon
.env-radio
.env-checkbox
.env-switch
Usages
Create an input group with a label, input and button using a combination of
.env-form-input, .env-button, and .env-form-label.
Make sure to add role="textbox" and aria-multiline="true" to the contenteditable element. The contenteditable element should also have aria-label or aria-labelledby attribute since a native label element is not allowed.
An optional placeholder may be added using attribute aria-placeholder on the contenteditable element.
Updated in 2025.05.1.
With the introduction of Customizable select elements, both the Select element and the Select component support a progressively enhanced approach that applies as much of the Envision styling as possible while maintaining native select element functionality. This feature is opt-in and can be enabled by adding a button with a selectedcontent tag inside the select element.
Select component
A <select> element wrapped in an element with the class .env-form-select will have the most consistent appearance across browsers. The dropdown arrow uses the .env-icon class and can be customized.
To opt in to the customizable version — which uses theme fonts, colors, and allows icons — add a button as the first child of the select, with a selectedcontent element inside the button. Use the .env-icon class to display icons in the options or in the selected value.
To display step markers below the input, add a datalist element and connect it to the input with the list attribute. The datalist must contain option elements with a value attribute.
<divclass="env-form-field"><labelfor="range-2"class="env-form-label">Range with markers</label><inputclass="env-range"type="range"id="range-2"value="100"min="50"max="250"step="50"list="range-2-markers"/></div><datalistid="range-2-markers"><optionvalue="50"></option><optionvalue="100"></option><optionvalue="150"></option><optionvalue="200"></option><optionvalue="250"></option></datalist>
All elements with class .env-range and [type="range"] are automatically initialized on
DOMContentLoaded.
Range elements added to the DOM after the document has loaded must be initialized from script.
// Initialize range elements added after DOMContentLoaded
envision.range();
Icons in input fields
Use .env-form-control to wrap .env-icon and .env-form-input.
<divclass="example-input-fields"><divclass="env-form-field"><labelfor="search-3"class="env-form-label">Input search with cancel button + icon left</label><divclass="env-form-control"><svgaria-hidden="true"class="env-icon"><usehref="/sitevision/envision-icons.svg#icon-search"></use></svg><inputtype="search"class="env-form-input env-form-input--search"placeholder="Placeholder text"id="search-3"/></div></div><divclass="env-form-field"><labelfor="text-4"class="env-form-label">Input text + icon right</label><divclass="env-form-control"><inputtype="text"class="env-form-input"placeholder="Placeholder text"id="text-4"/><svgaria-hidden="true"class="env-icon"><usehref="/sitevision/envision-icons.svg#icon-star"></use></svg></div></div></div>
Input group
Wrap text, input and button with .env-form-control to create an input group. Use .env-form-control to wrap .env-checkbox and .env-form-label.
Attribute [disabled] may be placed on form elements or fieldset elements to disable the form control(s). Attribute [readonly] is also available for input elements.
<formclass="env-form"action="/"><divclass="env-form-field"><labelfor="text-disabled"class="env-form-label">Disabled text input</label><inputtype="text"class="env-form-input"id="text-disabled"placeholder="Disabled"disabled/></div><divclass="env-form-field"><divclass="env-form-control"><inputclass="env-checkbox"type="checkbox"name="options"id="checkbox-disabled"checkeddisabled/><labelfor="checkbox-disabled"class="env-form-label">
Disabled checkbox
</label></div></div><divclass="env-form-field"><divclass="env-form-control"><inputid="radio-disabled-1"class="env-radio"type="radio"checkeddisabled/><labelfor="radio-disabled-1"class="env-form-label">
Disabled radio button
</label></div></div><fieldsetclass="env-form-fieldset"disabled><legendclass="env-form-legend">Disabled radio button group</legend><divclass="env-form-field"><divclass="env-form-control"><inputid="radio-disabled-2"class="env-radio"type="radio"/><labelfor="radio-disabled-2"class="env-form-label">
Disabled radio button group
</label></div></div><divclass="env-form-field"><divclass="env-form-control"><inputid="radio-disabled-3"class="env-radio"type="radio"checked/><labelfor="radio-disabled-3"class="env-form-label">
Disabled radio button group
</label></div></div></fieldset><divclass="env-form-field"><divclass="env-form-control"><labelfor="switch-disabled"class="env-form-label">
Disabled switch
</label><inputclass="env-switch"type="checkbox"name="options"id="switch-disabled"checkeddisabled/></div></div><divclass="env-form-field"><labelfor="text-readonly"class="env-form-label">Readonly text input</label><inputtype="text"class="env-form-input"id="text-readonly"placeholder="Readonly"readonly/></div></form>
Validation error
Add modifier .env-form-field--error to define error validation state. The aria-describedby attribute should be used to reference the ID of the text that describes the element.
Error validation state uses the Status color Error text.