| 1 |
--- |
| 2 |
id: 'Helper text' |
| 3 |
section: components |
| 4 |
cssPrefix: pf-v6-c-helper-text |
| 5 |
---## Examples |
| 6 |
|
| 7 |
### Basic |
| 8 |
|
| 9 |
```html |
| 10 |
<div class="pf-v6-c-helper-text"> |
| 11 |
<div class="pf-v6-c-helper-text__item"> |
| 12 |
<span class="pf-v6-c-helper-text__item-text">This is default helper text</span> |
| 13 |
</div> |
| 14 |
</div> |
| 15 |
<div class="pf-v6-c-helper-text"> |
| 16 |
<div class="pf-v6-c-helper-text__item pf-m-indeterminate"> |
| 17 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 18 |
<i class="fas fa-fw fa-minus" aria-hidden="true"></i> |
| 19 |
</span> |
| 20 |
<span class="pf-v6-c-helper-text__item-text"> |
| 21 |
<span class="pf-v6-screen-reader">Indeterminate:</span> |
| 22 |
This is indeterminate helper text |
| 23 |
</span> |
| 24 |
</div> |
| 25 |
</div> |
| 26 |
<div class="pf-v6-c-helper-text"> |
| 27 |
<div class="pf-v6-c-helper-text__item pf-m-warning"> |
| 28 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 29 |
<i class="fas fa-fw fa-exclamation-triangle" aria-hidden="true"></i> |
| 30 |
</span> |
| 31 |
<span class="pf-v6-c-helper-text__item-text"> |
| 32 |
<span class="pf-v6-screen-reader">Warning:</span> |
| 33 |
This is warning helper text |
| 34 |
</span> |
| 35 |
</div> |
| 36 |
</div> |
| 37 |
<div class="pf-v6-c-helper-text"> |
| 38 |
<div class="pf-v6-c-helper-text__item pf-m-success"> |
| 39 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 40 |
<i class="fas fa-fw fa-check-circle" aria-hidden="true"></i> |
| 41 |
</span> |
| 42 |
<span class="pf-v6-c-helper-text__item-text"> |
| 43 |
<span class="pf-v6-screen-reader">Success:</span> |
| 44 |
This is success helper text |
| 45 |
</span> |
| 46 |
</div> |
| 47 |
</div> |
| 48 |
<div class="pf-v6-c-helper-text"> |
| 49 |
<div class="pf-v6-c-helper-text__item pf-m-error"> |
| 50 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 51 |
<i class="fas fa-fw fa-exclamation-circle" aria-hidden="true"></i> |
| 52 |
</span> |
| 53 |
<span class="pf-v6-c-helper-text__item-text"> |
| 54 |
<span class="pf-v6-screen-reader">Error:</span> |
| 55 |
This is error helper text |
| 56 |
</span> |
| 57 |
</div> |
| 58 |
</div> |
| 59 |
|
| 60 |
``` |
| 61 |
|
| 62 |
### Multiple items |
| 63 |
|
| 64 |
You can include multiple `HelperTextItem` components inside a single `HelperText` container. |
| 65 |
|
| 66 |
```html |
| 67 |
<ul class="pf-v6-c-helper-text" role="list"> |
| 68 |
<li class="pf-v6-c-helper-text__item"> |
| 69 |
<span class="pf-v6-c-helper-text__item-text">This is default helper text</span> |
| 70 |
</li> |
| 71 |
<li class="pf-v6-c-helper-text__item"> |
| 72 |
<span |
| 73 |
class="pf-v6-c-helper-text__item-text" |
| 74 |
>This is another default helper text in the same block</span> |
| 75 |
</li> |
| 76 |
<li class="pf-v6-c-helper-text__item"> |
| 77 |
<span |
| 78 |
class="pf-v6-c-helper-text__item-text" |
| 79 |
>And this is more default text in the same block</span> |
| 80 |
</li> |
| 81 |
</ul> |
| 82 |
|
| 83 |
``` |
| 84 |
|
| 85 |
### Dynamic |
| 86 |
|
| 87 |
If the `HelperTextItem` components are expected or intended to dynamically update in some way, you should use a dynamic `HelperText` container. |
| 88 |
|
| 89 |
```html |
| 90 |
<div class="pf-v6-c-helper-text"> |
| 91 |
<div class="pf-v6-c-helper-text__item pf-m-dynamic"> |
| 92 |
<span class="pf-v6-c-helper-text__item-text">This is default helper text</span> |
| 93 |
</div> |
| 94 |
</div> |
| 95 |
<div class="pf-v6-c-helper-text"> |
| 96 |
<div class="pf-v6-c-helper-text__item pf-m-indeterminate pf-m-dynamic"> |
| 97 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 98 |
<i class="fas fa-fw fa-minus" aria-hidden="true"></i> |
| 99 |
</span> |
| 100 |
<span class="pf-v6-c-helper-text__item-text"> |
| 101 |
<span class="pf-v6-screen-reader">Indeterminate:</span> |
| 102 |
This is indeterminate helper text |
| 103 |
</span> |
| 104 |
</div> |
| 105 |
</div> |
| 106 |
<div class="pf-v6-c-helper-text"> |
| 107 |
<div class="pf-v6-c-helper-text__item pf-m-warning pf-m-dynamic"> |
| 108 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 109 |
<i class="fas fa-fw fa-exclamation-triangle" aria-hidden="true"></i> |
| 110 |
</span> |
| 111 |
<span class="pf-v6-c-helper-text__item-text"> |
| 112 |
<span class="pf-v6-screen-reader">Warning:</span> |
| 113 |
This is warning helper text |
| 114 |
</span> |
| 115 |
</div> |
| 116 |
</div> |
| 117 |
<div class="pf-v6-c-helper-text"> |
| 118 |
<div class="pf-v6-c-helper-text__item pf-m-success pf-m-dynamic"> |
| 119 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 120 |
<i class="fas fa-fw fa-check-circle" aria-hidden="true"></i> |
| 121 |
</span> |
| 122 |
<span class="pf-v6-c-helper-text__item-text"> |
| 123 |
<span class="pf-v6-screen-reader">Success:</span> |
| 124 |
This is success helper text |
| 125 |
</span> |
| 126 |
</div> |
| 127 |
</div> |
| 128 |
<div class="pf-v6-c-helper-text"> |
| 129 |
<div class="pf-v6-c-helper-text__item pf-m-error pf-m-dynamic"> |
| 130 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 131 |
<i class="fas fa-fw fa-exclamation-circle" aria-hidden="true"></i> |
| 132 |
</span> |
| 133 |
<span class="pf-v6-c-helper-text__item-text"> |
| 134 |
<span class="pf-v6-screen-reader">Error:</span> |
| 135 |
This is error helper text |
| 136 |
</span> |
| 137 |
</div> |
| 138 |
</div> |
| 139 |
|
| 140 |
``` |
| 141 |
|
| 142 |
### Dynamic list |
| 143 |
|
| 144 |
```html |
| 145 |
<ul class="pf-v6-c-helper-text" role="list"> |
| 146 |
<li class="pf-v6-c-helper-text__item pf-m-success pf-m-dynamic"> |
| 147 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 148 |
<i class="fas fa-fw fa-check-circle" aria-hidden="true"></i> |
| 149 |
</span> |
| 150 |
<span class="pf-v6-c-helper-text__item-text"> |
| 151 |
<span class="pf-v6-screen-reader">Success:</span> |
| 152 |
Must be at least 14 characters |
| 153 |
</span> |
| 154 |
</li> |
| 155 |
<li class="pf-v6-c-helper-text__item pf-m-error pf-m-dynamic"> |
| 156 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 157 |
<i class="fas fa-fw fa-exclamation-circle" aria-hidden="true"></i> |
| 158 |
</span> |
| 159 |
<span class="pf-v6-c-helper-text__item-text"> |
| 160 |
<span class="pf-v6-screen-reader">Error:</span> |
| 161 |
Cannot contain any variation of the word "redhat" |
| 162 |
</span> |
| 163 |
</li> |
| 164 |
<li class="pf-v6-c-helper-text__item pf-m-success pf-m-dynamic"> |
| 165 |
<span class="pf-v6-c-helper-text__item-icon"> |
| 166 |
<i class="fas fa-fw fa-check-circle" aria-hidden="true"></i> |
| 167 |
</span> |
| 168 |
<span class="pf-v6-c-helper-text__item-text"> |
| 169 |
<span class="pf-v6-screen-reader">Success:</span> |
| 170 |
Must include at least 3 of the following: lowercase letter, uppercase letters, numbers, symbols |
| 171 |
</span> |
| 172 |
</li> |
| 173 |
</ul> |
| 174 |
|
| 175 |
``` |
| 176 |
|
| 177 |
### Usage |
| 178 |
|
| 179 |
| Class | Applied to | Outcome | |
| 180 |
| -- | -- | -- | |
| 181 |
| `.pf-v6-c-helper-text` | `<div>`, `<ul>` | Initiates the helper text component. **Required** | |
| 182 |
| `.pf-v6-c-helper-text__item` | `<div>`, `<li>` | Initiates a helper text item. **Required** | |
| 183 |
| `.pf-v6-c-helper-text__item-icon` | `<span>` | Initiates a helper text item icon. **Required when used in `.pf-v6-c-helper-text__item.pf-m-dynamic`** | |
| 184 |
| `.pf-v6-c-helper-text__item-text` | `<span>` | Initiates a helper text item text. **Required** | |
| 185 |
| `.pf-m-dynamic` | `.pf-v6-c-helper-text__item` | Modifies a helper text item to be dynamic. For use when the item changes state as the form field the text is associated with is updated. | |
| 186 |
| `.pf-m-indeterminate` | `.pf-v6-c-helper-text__item` | Modifies a helper text item for indeterminate state styles. | |
| 187 |
| `.pf-m-warning` | `.pf-v6-c-helper-text__item` | Modifies a helper text item for warning state styles. | |
| 188 |
| `.pf-m-success` | `.pf-v6-c-helper-text__item` | Modifies a helper text item for success state styles. | |
| 189 |
| `.pf-m-error` | `.pf-v6-c-helper-text__item` | Modifies a helper text item for error state styles. | |
| 190 |
| `.pf-m-hidden` | `.pf-v6-c-helper-text` | Hides helper text. | |