Cardiff Council Content and design system

www.cardiff.gov.uk

Forms

selecting

Select fieldRadio buttonsCheckbox

layout

Message boxNavigation buttonsValidation and Errors

input

TextEmailTelephoneTextAreaSearch boxDateTimeRangeFileNumber

Text

A simple text field for entering a text value.  Example, your name.

How to use this component

This element should be used for adding a simple text field to a form.

The autocomplete attribute can be used to automatically populate the field with a value. For example, completing the name field with the value saved in the users profile data.

The aria-label can be used to provide a more desciptive label for screen readers if a normal label cannot be used, or is not descriptive enough.

You can also use aria-describedby to hook up to the more descriptive instruction placed underneath the form field.


Code Resource

<label for="firstname" class="form_formLabelTitle">First name *</label>
<input type="text" name="firstname" id="firstname" class="form_formTextbox" title="Enter your first name" aria-describedby="firstname_description" autocomplete="given-name" >
<span id="firstname_description" class="form_formInformationMessage">Please provide your first name only.</span>
/* Input Fields and Label*/
.form_formTextbox {
    width: 100%;
    font-size: medium;
    margin-bottom: 15px;
    float: right;
    display: block;
    border-radius: 0px;
    border: 1px solid silver;
    padding: 2px 5px;
    border-radius: 6px;
    height: 49px;
    text-indent: 10px;
}

.form_formTextbox:hover, .form_formTextbox:focus {
    border: 1px solid #015b66;
    background: #f9f9f9;
outline: none;
}

.form_formLabelTitle {
    width: 100%;
    font-size: 1em;
    color: black;
    float: left;
    text-align: left;
    padding: 7px;
    padding-left: 0px;
}

.form_formInformationMessage {
    width: 100%;
    float: left;
    margin-bottom: 10px;
    color: #464545;
    position: relative;
    top: -10px;
    font-size: 0.9em;
    float: left;
}


/* END */

Working Example

Please provide your first name only.