Text input
The following page documents visual specifications such as color, typography, structure, size, and AI presence.
Color
Text input color
Element | Property | Color token |
---|---|---|
Label | text color |
|
Field text | text color |
|
Placeholder text | text color |
|
Helper text | text color |
|
Field | background-color |
|
border-bottom |
|
* Denotes a contextual color token that will change values based on the layer it is placed on.
![Example of an enabled text input in the default style](/static/40e069ce48f08c05c4999b839a569eac/3cbba/text-input-style-color-fixed.png)
![Example of an enabled text input in the fluid style](/static/11add759abeba6a8b338de6448510b83/3cbba/text-input-style-color-fluid.png)
Interactive state color
State | Element | Property | Color token |
---|---|---|---|
Focus | Field | border |
|
Invalid | Field | border |
|
Error message | text color |
| |
Error icon | svg |
| |
Warning | Warning message | text color |
|
Warning icon | svg |
| |
Disabled | Field | background |
|
Field (default) | border-bottom | transparent | |
Field (fluid) | border-bottom |
| |
Field text | text color |
| |
Read-only | Field (default) | background | transparent |
Field (fluid) | background |
| |
Field text (default) | text color |
| |
Field text (fluid) | text color |
| |
Field | border-bottom |
|
* Denotes a contextual color token that will change values based on the layer it is placed on.
![Examples of text input states in the default style](/static/6589fd21054520c4ca3fefc2b2c49184/3cbba/text-input-style-states-fixed.png)
![Examples of text input states in the fluid style](/static/c2e1f0ef39a9f5f4b4afa464048d846e/3cbba/text-input-style-states-fluid.png)
Text area color
Element | Property | Color token |
---|---|---|
Label | text color |
|
Field text | text color |
|
Placeholder text | text color |
|
Helper text | text color |
|
Field | background-color |
|
border-bottom |
|
* Denotes a contextual color token that will change values based on the layer it is placed on.
![Example of an enabled text area in the default style](/static/15e5f8a42dd757b90a8e92a05cbeeb2e/3cbba/text-area-style-color-fixed.png)
![Example of an enabled text area in the fluid style](/static/9b9d6ea79d45ff99b755fc668f867c49/3cbba/text-area-style-color-fluid.png)
Interactive state color
State | Element | Property | Color token |
---|---|---|---|
Focus | Field | border |
|
Invalid | Field | border |
|
Error message | text color |
| |
Error icon | svg |
| |
Warning | Warning message | text color |
|
Warning icon | svg |
| |
Disabled | Field | background |
|
Field (default) | border-bottom | transparent | |
Field (fluid) | border-bottom |
| |
Field text | text color |
| |
Read-only | Field (default) | background | transparent |
Field (fluid) | background |
| |
Field text (default) | text color |
| |
Field text (fluid) | text color |
| |
Field | border-bottom |
|
* Denotes a contextual color token that will change values based on the layer it is placed on.
![Examples of text area states in the default style](/static/40963b58e67c9feac0bf868c571755bf/3cbba/text-area-style-states-fixed.png)
![Examples of text area states in the fluid style](/static/a51f09ee59e77b4a1b2d60fc5b72f82f/3cbba/text-area-style-states-fluid.png)
Typography
Text input labels and field text should be set in sentence case, with only the first word in a phrase and any proper nouns capitalized. Text input labels should be three words or less.
Element | Font-size (px/rem) | Font-weight | Type token |
---|---|---|---|
Label | 12 / 0.75 | Regular / 400 |
|
Field text | 14 / 0.875 | Regular / 400 |
|
Helper text | 12 / 0.75 | Regular / 400 |
|
Error and warning message | 12 / 0.75 | Regular / 400 |
|
Structure
Default text input structure
Element | Property | px / rem | Spacing token |
---|---|---|---|
Label | margin-bottom | 8 / 0.5 |
|
Helper text | margin-top | 4 / 0.25 |
|
Input text | padding-left, padding-right | 16 / 1 |
|
Field | border-bottom | 1px | – |
Focus | border | 2px | – |
Error | border | 2px | – |
![Structure and spacing measurements for default text input](/static/a576b1cfdbc7a1333462a80937b4d94a/3cbba/text-input-style-structure-fixed.png)
Structure and spacing measurements for default text input | px / rem
Fluid text input structure
Element | Property | px / rem | Spacing token |
---|---|---|---|
Label | padding-bottom | 4 / 0.25 |
|
Field | height | 64 / 4 |
|
padding-left, padding-right | 16 / 1 |
| |
padding-top, padding-bottom | 13 / 0.8125 | – | |
border-bottom | 1px | – | |
Focus | border | 2px | – |
Error | border | 2px | – |
![Structure and spacing measurements for fluid text input](/static/9056540a57f5ada3672e48c52a77d0d7/3cbba/text-input-style-structure-fluid.png)
Structure and spacing measurements for fluid text input | px / rem
Default text area structure
Element | Property | px / rem | Spacing token |
---|---|---|---|
Label | margin-bottom | 8 / 0.5 |
|
Field | height | varies | – |
padding-left, padding-right | 16 / 1 |
| |
padding-top, padding-bottom | 11 / 0.6875 | – | |
border-bottom | 1px | – | |
Field: focus | border | 2px | – |
Helper text | margin-top | 4 / 0.25 |
|
![Structure and spacing measurements for default text area](/static/92b143a100daedbe20c59cd952d0abea/3cbba/text-area-style-structure-fixed.png)
Structure and spacing measurements for default text area | px / rem
Fluid text area structure
Element | Property | px / rem | Spacing token |
---|---|---|---|
Label | margin-bottom | 4 / 0.25 |
|
Field | height | varies | – |
padding-left, padding-right | 16 / 1 |
| |
padding-top, padding-bottom | 11 / 0.6875 | – | |
border-bottom | 1px | – | |
Field: focus | border | 2px | – |
![Structure and spacing measurements for fluid text area](/static/1001a503d4d6a8f17b5a853891fa203e/3cbba/text-area-style-structure-fluid.png)
Structure and spacing measurements for fluid text area | px / rem
Size
These sizes apply only to the default style of text input.
Element | Size | Height (px / rem) |
---|---|---|
Input | Small (sm) | 32 / 2 |
Medium (md) | 40 / 2.5 | |
Large (lg) | 48 / 3 |
![Sizes for text input](/static/33cc8b9cf517a837ea8e29f830b7aaac/3cbba/text-input-style-size.png)
Text input default style sizes | px / rem
AI presence
The following are the unique styles applied to the component when the AI label is present. Unless specified, all other tokens in the component remain the same as the non-AI variant. For more information on the AI style elements, see the Carbon for AI guidelines.
Element | Property | Token / Size |
---|---|---|
Linear gradient | start |
|
stop |
| |
Field | border-bottom |
|
background color |
| |
AI label | size | mini |
* Denotes a contextual color token that will change values based on the layer it is placed on.
![Default text input and text area AI example](/static/9526ce2c1caec08c78e584e4339edacc/3cbba/text-input-text-area-ai-presence-ai-revert-default.png)
![Fluid text input and text area AI example](/static/cc1c5885244bc823a76619a7aee77a52/3cbba/text-input-text-area-ai-presence-ai-revert-fluid.png)
Feedback
Help us improve this component by providing feedback, asking questions, and leaving any other comments on GitHub.