Debian Codegraph @

node/@patternfly/patternfly/docs/demos/HelperText/examples/HelperText.md

raw
1 ---
2 id: 'Helper text'
3 section: components
4 ---## Examples
5
6 ### Helper text on a form
7
8 ```html
9 <form class="pf-v6-c-form" novalidate>
10 <div class="pf-v6-c-form__group">
11 <div class="pf-v6-c-form__group-label"><label class="pf-v6-c-form__label" for="helper-text-form-name">
12 <span class="pf-v6-c-form__label-text">Name</span>&nbsp;<span class="pf-v6-c-form__label-required" aria-hidden="true">&#42;</span></label>
13 </div>
14 <div class="pf-v6-c-form__group-control">
15 <span class="pf-v6-c-form-control pf-m-required">
16 <input
17 required
18 type="text"
19 id="helper-text-form-name"
20 name="helper-text-form-name"
21 aria-describedby="helper-text-form-name-helper"
22 />
23 </span>
24 <div
25 class="pf-v6-c-form__helper-text"
26 aria-live="polite"
27 id="helper-text-form-name-helper"
28 >
29 <div class="pf-v6-c-helper-text">
30 <div class="pf-v6-c-helper-text__item">
31 <span
32 class="pf-v6-c-helper-text__item-text"
33 >This is helper text on a form field.</span>
34 </div>
35 </div>
36 </div>
37 </div>
38 </div>
39 <div class="pf-v6-c-form__group">
40 <div class="pf-v6-c-form__group-label"><label class="pf-v6-c-form__label" for="helper-text-form-email">
41 <span class="pf-v6-c-form__label-text">E-mail</span>&nbsp;<span class="pf-v6-c-form__label-required" aria-hidden="true">&#42;</span></label>
42 </div>
43 <div class="pf-v6-c-form__group-control">
44 <span class="pf-v6-c-form-control pf-m-required pf-m-warning">
45 <input
46 required
47 type="text"
48 id="helper-text-form-email"
49 name="helper-text-form-email"
50 aria-describedby="helper-text-form-email-helper"
51 />
52 <span class="pf-v6-c-form-control__utilities">
53 <span class="pf-v6-c-form-control__icon pf-m-status">
54 <i class="fas fa-exclamation-triangle" aria-hidden="true"></i>
55 </span>
56 </span>
57 </span>
58
59 <div
60 class="pf-v6-c-form__helper-text"
61 aria-live="polite"
62 id="helper-text-form-email-helper"
63 >
64 <div class="pf-v6-c-helper-text">
65 <div class="pf-v6-c-helper-text__item pf-m-warning">
66 <span class="pf-v6-c-helper-text__item-icon">
67 <i class="fas fa-fw fa-exclamation-triangle" aria-hidden="true"></i>
68 </span>
69 <span class="pf-v6-c-helper-text__item-text">
70 <span class="pf-v6-screen-reader">Warning:</span>
71 This is helper text for a warning.
72 </span>
73 </div>
74 </div>
75 </div>
76 </div>
77 </div>
78 <div class="pf-v6-c-form__group">
79 <div class="pf-v6-c-form__group-label"><label class="pf-v6-c-form__label" for="helper-text-form-address">
80 <span class="pf-v6-c-form__label-text">Address</span>&nbsp;<span class="pf-v6-c-form__label-required" aria-hidden="true">&#42;</span></label>
81 </div>
82 <div class="pf-v6-c-form__group-control">
83 <span class="pf-v6-c-form-control pf-m-required pf-m-error">
84 <input
85 required
86 type="text"
87 id="helper-text-form-address"
88 name="helper-text-form-address"
89 aria-invalid="true"
90 aria-describedby="helper-text-form-address-helper"
91 />
92 <span class="pf-v6-c-form-control__utilities">
93 <span class="pf-v6-c-form-control__icon pf-m-status">
94 <i class="fas fa-exclamation-circle" aria-hidden="true"></i>
95 </span>
96 </span>
97 </span>
98
99 <div
100 class="pf-v6-c-form__helper-text"
101 aria-live="polite"
102 id="helper-text-form-address-helper"
103 >
104 <ul class="pf-v6-c-helper-text" role="list">
105 <li class="pf-v6-c-helper-text__item pf-m-success pf-m-dynamic">
106 <span class="pf-v6-c-helper-text__item-icon">
107 <i class="fas fa-fw fa-check-circle" aria-hidden="true"></i>
108 </span>
109 <span class="pf-v6-c-helper-text__item-text">
110 <span class="pf-v6-screen-reader">Success:</span>
111 This criteria has been met.
112 </span>
113 </li>
114 <li class="pf-v6-c-helper-text__item pf-m-error pf-m-dynamic">
115 <span class="pf-v6-c-helper-text__item-icon">
116 <i class="fas fa-fw fa-exclamation-circle" aria-hidden="true"></i>
117 </span>
118 <span class="pf-v6-c-helper-text__item-text">
119 <span class="pf-v6-screen-reader">Error:</span>
120 This criteria has not been met.
121 </span>
122 </li>
123 <li class="pf-v6-c-helper-text__item pf-m-success pf-m-dynamic">
124 <span class="pf-v6-c-helper-text__item-icon">
125 <i class="fas fa-fw fa-check-circle" aria-hidden="true"></i>
126 </span>
127 <span class="pf-v6-c-helper-text__item-text">
128 <span class="pf-v6-screen-reader">Success:</span>
129 This criteria has been met.
130 </span>
131 </li>
132 </ul>
133 </div>
134 </div>
135 </div>
136 <div class="pf-v6-c-form__group">
137 <div class="pf-v6-c-form__group-label"><label class="pf-v6-c-form__label" for="helper-text-form-comment">
138 <span class="pf-v6-c-form__label-text">Comment</span></label>
139 </div>
140 <div class="pf-v6-c-form__group-control">
141 <span class="pf-v6-c-form-control pf-m-success">
142 <input
143 value="This is a valid comment"
144 type="text"
145 id="helper-text-form-comment"
146 name="helper-text-form-comment"
147 aria-describedby="helper-text-form-comment-helper"
148 />
149 <span class="pf-v6-c-form-control__utilities">
150 <span class="pf-v6-c-form-control__icon pf-m-status">
151 <i class="fas fa-check-circle" aria-hidden="true"></i>
152 </span>
153 </span>
154 </span>
155
156 <div
157 class="pf-v6-c-form__helper-text"
158 aria-live="polite"
159 id="helper-text-form-comment-helper"
160 >
161 <div class="pf-v6-c-helper-text">
162 <div class="pf-v6-c-helper-text__item pf-m-success pf-m-dynamic">
163 <span class="pf-v6-c-helper-text__item-icon">
164 <i class="fas fa-fw fa-check-circle" aria-hidden="true"></i>
165 </span>
166 <span class="pf-v6-c-helper-text__item-text">
167 <span class="pf-v6-screen-reader">Success:</span>
168 This is dynamic helper text with an icon showing success.
169 </span>
170 </div>
171 </div>
172 </div>
173 </div>
174 </div>
175 </form>
176
177 ```
178
179 ## Documentation
180
181 When adding helper text to a form field, place it within the form helper text element.