Hint text
Explains what a field expects or why its value is invalid.
Variants
default
guides,
destructive
reports an error,
disabled
matches a disabled control.
Username may only contain alphanumeric characters
This handle is already taken
Enable Single Sign-On to configure automatic enrollment
<.hint_text label="Username may only contain alphanumeric characters" />
<.hint_text label="This handle is already taken" variant="destructive" />
<.hint_text label="Enable Single Sign-On to configure automatic enrollment" variant="disabled" />
Two sentences
When a hint needs a second sentence, use it for an example or a rule of thumb.
Jobs and pull requests from these branches also save their changes. Use * as a wildcard.
<.hint_text label="Jobs and pull requests from these branches also save their changes. Use * as a wildcard." />
In inputs
Text inputs render the hint from
hint
, and switch to the destructive variant when
error
is set.
Username may only contain alphanumeric characters
Use only letters and numbers
<.text_input
id="hint-text-input-hint"
name="username"
label="Username"
value="tuist"
hint="Username may only contain alphanumeric characters"
/>
<.text_input
id="hint-text-input-error"
name="username"
label="Username"
value="tuist-team"
error="Use only letters and numbers"
/>
Guidelines
-
Text input and text area render hint text from their
hintanderrorattributes. Add the component yourself only below controls that don't, such as a custom field. -
Use
destructivefor validation errors and say how to fix the value: Use only letters and numbers, rather than Invalid input. -
Use
disabledbelow a disabled control so the hint reads as inactive too. - Every variant shows the same alert icon, so the color and the wording carry the meaning.
- Keep hints to a sentence or two. Longer explanations belong in the page or a link to the docs.
API reference
<.hint_text>
| Attribute | Type | Default | Description |
|---|---|---|---|
|
label
Required
|
string
|
–
|
The hint text
|
|
variant
|
string
|
"default"
|
The variant of the hint text
"default""destructive""disabled"
|