Skip to content

CSS

A field wraps a button or input with a label, helper text, and error message. The tng-field element is the wrapper; the tng-field-control element is the interactive shell, available as a button or an input.

A field wraps a control with a label, helper text, and error message.

<div class="tng-field">
<label class="tng-field-label" for="field-username">Username</label>
<div class="tng-field-control">
<input
class="tng-field-control-input"
id="field-username"
type="text"
/>
</div>
<div class="tng-field-info">
<i class="tng-icon icon-info"></i>
<span>Helper text for the input field.</span>
</div>
<div class="tng-field-error">
<i class="tng-icon icon-error"></i>
<span>Error message if applicable.</span>
</div>
</div>
Helper text for the input field.
Error message if applicable.

The control is the base interactive element used in form fields, available as a button or input.

Use a control button to trigger custom dropdowns, date pickers, or other interactive elements.

<div class="tng-field-control">
<button class="tng-field-control-button">Select an item</button>
</div>

Use an input control to allow users to enter text or data.

<div class="tng-field-control">
<input
class="tng-field-control-input"
type="text"
aria-label="Username"
/>
</div>
<div class="tng-field-control">
<input
class="tng-field-control-input"
type="text"
aria-label="Username"
/>
<button
class="p-absolute tng-icon-button is-ghost"
aria-label="More info"
>
<i aria-hidden="true" class="tng-icon icon-info"></i>
</button>
</div>
<div class="tng-field-control">
<i aria-hidden="true" class="tng-icon icon-car"></i>
<button class="tng-field-control-button">Select model</button>
<i aria-hidden="true" class="tng-icon icon-chevron-down"></i>
</div>

A dynamic label can be combined with an input control to provide context about the expected input. With .is-lg, the label sits inside the empty field and shrinks above it while the input has focus.

<div class="tng-field-control">
<label class="tng-field-control-label" for="field-email">
Email address
</label>
<input
class="tng-field-control-input"
id="field-email"
type="text"
/>
</div>
<div class="tng-field-control">
<label class="tng-field-control-label is-lg" for="field-email-lg">
Email address
</label>
<input
class="tng-field-control-input"
id="field-email-lg"
type="text"
/>
</div>

In case of an input control you can rely on the native HTML required attribute to indicate that a form control is required. If that’s not an option, you can use the is-required class anywhere within the control to show the required state.

<div class="tng-field-control">
<button class="tng-field-control-button is-required">
Select an item
</button>
<i aria-hidden="true" class="tng-icon icon-chevron-down"></i>
</div>
<div class="tng-field-control">
<label class="tng-field-control-label" for="field-email-required">
Email address
</label>
<input
class="tng-field-control-input"
id="field-email-required"
type="text"
required
/>
</div>
<div class="tng-field-control">
<input
class="tng-field-control-input"
type="text"
aria-label="Username"
disabled
/>
</div>
<div class="tng-field-control">
<button class="tng-field-control-button" disabled>
Select an item
</button>
</div>
<div class="tng-field-control is-invalid">
<input
class="tng-field-control-input"
type="text"
aria-label="Username"
/>
</div>