Skip to content

CSS: form-field-messages ​

.instui-form-field-messages — Field help and validation messages — hint, error, success, and screen-reader-only — with a glyph on error and success.

Sets its own gap between stacked messages; chaining a -gap-* spacing utility modifier overrides that built-in value.

Source: form-field-messages.css

Usage ​

css
@import "@pantoken/components/components.css";
@import "@pantoken/components/form-field-messages.css";

Examples ​

html
<div class="instui-form-field-messages">
  <span class="instui-form-field-message -type-hint">We'll never share it.</span>
  <span class="instui-form-field-message -type-error">Enter a valid email address.</span>
</div>

Structure ​

text
.instui-form-field-messages
  .instui-form-field-message
flowchart TD n0[".instui-form-field-messages"]:::cssdoc-root n1(".instui-form-field-message"):::cssdoc-part n0 --> n1 classDef cssdoc-root stroke-width:1px; classDef cssdoc-part stroke-width:1px; classDef cssdoc-slot stroke-width:1px; classDef cssdoc-component stroke-width:1px;

Modifiers ​

ModifierDescription
.-type-new-errorAlias — maps to .-type-error.

Parts ​

PartDescription
.instui-form-field-messageAn individual message; its -type-* picks the hint, error, success, or screen-reader-only variant.

Pseudo-elements ​

Pseudo-elementDescription
::beforeRenders the leading status glyph on error and success messages: an alert circle for errors and a check circle for success.

Conditions ​

TypeQueryDescription
media(forced-colors: active)—

Accessibility ​

A -type-screenreader-only message is visually hidden but stays in the accessibility tree, so it's still announced; pair error and success messages with the field via aria-describedby so assistive tech reads them with the control.

ConditionsRebrand (light)Rebrand (dark)CanvasCanvas High Contrast
forced-colors-focus-visibleWCAG 2.2 1.4.11, 2.4.7PassPassPassPass
more-contrast-respectedWCAG 2.2 1.4.3, 1.4.6PassPassPassPass
reflow-at-320pxWCAG 2.2 1.4.10PassPassPassPass
text-spacing-no-clippingWCAG 2.2 1.4.12PassPassPassPass
Screen reader (simulated)Rebrand (light)Rebrand (dark)CanvasCanvas High Contrast
AnnouncementsPassPassPassPass

These automated results do not establish that the page meets WCAG; manual review is still needed.

Tokens consumed ​

TokenTypeValue
--instui-component-form-field-layout-gap-primitives<length>0.5rem
--instui-component-form-field-message-error-text-color<color>LightDarklight-dark(#C51F22, #FA917F)
--instui-component-form-field-message-font-family[ <font-family-name> | <generic-font-family> ]#Atkinson Hyperlegible Next, "Helvetica Neue", Helvetica, Arial, sans-serif
--instui-component-form-field-message-font-size<length>0.875rem
--instui-component-form-field-message-font-weight<integer>400
--instui-component-form-field-message-hint-text-color<color>LightDarklight-dark(#273540, #ffffff)
--instui-component-form-field-message-line-height<length>1.25rem
--instui-component-form-field-message-success-text-color<color>LightDarklight-dark(#017533, #61C378)
--instui-icon-circle-check<image>url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Ccircle%20cx%3D%2212%22%20cy%3D%2212%22%20r%3D%2210%22%2F%3E%3Cpath%20d%3D%22m16%209-5.5%205.5L8%2012%22%2F%3E%3C%2Fsvg%3E')
--instui-icon-triangle-exclamation-point<image>url('data:image/svg+xml;utf8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22none%22%20stroke%3D%22currentColor%22%20stroke-width%3D%222%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20d%3D%22m21.73%2018-8-14a2%202%200%200%200-3.48%200l-8%2014A2%202%200%200%200%204%2021h16a2%202%200%200%200%201.73-3%22%2F%3E%3Cpath%20d%3D%22M12%209v4%22%2F%3E%3Cpath%20d%3D%22M12%2017h.01%22%2F%3E%3C%2Fsvg%3E')
  • form-field — Wraps a label, controls, and these messages.