@xsolla/xui-field-group 0.189.2 → 0.189.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -3,11 +3,41 @@
|
|
|
3
3
|
A cross-platform wrapper that adds a label, required indicator, optional icon, description, and helper text around a form field with consistent vertical spacing.
|
|
4
4
|
|
|
5
5
|
<!-- BEGIN:xui-mcp-instructions:field-group -->
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
A layout wrapper that adds a label, an optional description, and helper text to any form control. FieldGroup is not an input itself — it is the scaffolding that gives a field its visual and semantic identity within a form. Any input component from the design system can be placed in the content slot.
|
|
7
|
+
|
|
8
|
+
### When to use
|
|
9
|
+
- Whenever a form control needs a visible label, description, or helper text
|
|
10
|
+
- To ensure consistent vertical spacing, label alignment, and text hierarchy across all fields in a form
|
|
11
|
+
- To apply validation messages and error states in a standardised way
|
|
12
|
+
- To wrap non-standard controls (ToggleButtonGroup, ImageUploader, InputRange, Drag&Drop Uploader) in the same form field visual pattern as regular inputs
|
|
13
|
+
|
|
14
|
+
### When not to use
|
|
15
|
+
- When a field needs no label and no helper text — place the control directly without a FieldGroup wrapper
|
|
16
|
+
- As a layout grid for multi-column form rows — use a separate grid or flex layout to position FieldGroup instances side by side
|
|
17
|
+
- To group multiple related fields under one heading — use a fieldset / legend pattern or a form section component instead
|
|
18
|
+
|
|
19
|
+
### Content guidelines
|
|
20
|
+
- Label — short, specific, sentence case. Aim for 1–3 words. Examples: *"Email"*, *"Card number"*, *"End date"*, *"Company name"*.
|
|
21
|
+
- Description — one line, informational, no punctuation at end. Example: *"Visible to all team members"*, *"YYYY-MM-DD format"*.
|
|
22
|
+
- Helper text (hint) — factual, concise. One line. Example: *"8–20 characters"*, *"CSV files only"*, *"Enter the 6-digit code from your authenticator app"*.
|
|
23
|
+
- Helper text (error) — specific and actionable. Say what went wrong and what to do: *"Enter a valid email address"* not *"Invalid value"*. *"File must be smaller than 10 MB"* not *"File too large"*.
|
|
24
|
+
- Avoid redundancy — if the label clearly communicates the field's purpose, do not repeat it in the description or helper text.
|
|
25
|
+
|
|
26
|
+
### Behaviour guidelines
|
|
27
|
+
- Label association — the label must be programmatically linked to the control. For standard inputs use <label for=*"fieldId"*>. For complex controls (ToggleButtonGroup, InputRange, ImageUploader) that are not native <input> elements, use aria-labelledby on the control's container or role=*"group"* with aria-label.
|
|
28
|
+
- Required fields — mark required fields visually (asterisk) and in code (aria-required=*"true"* on the control or required on the input). Always explain the required field convention at the top of the form.
|
|
29
|
+
- Error state — when a field fails validation, the embedded control switches to its State=Error appearance, and the helper text changes to the error message in error colour. Both transitions happen simultaneously. Clear the error when the user begins correcting the value.
|
|
30
|
+
- Description visibility — Description is hidden by default. Enable it only for fields that genuinely need extra context. Avoid enabling Description on every field — it adds visual weight and reduces form scannability.
|
|
31
|
+
- Size consistency — all FieldGroup instances in the same form section must share the same Size. Mixing sizes within a form breaks the visual rhythm and makes labels and helper text appear inconsistent.
|
|
32
|
+
- Read-only fields — for fields that display a value but are not editable, use Label=true and the appropriate read-only control presentation. Do not use State=Disable for read-only display — reserve Disable for temporarily unavailable fields.
|
|
33
|
+
|
|
34
|
+
### Accessibility
|
|
35
|
+
- The Label must be associated with the control via <label for> (for native inputs) or aria-labelledby / aria-label (for custom controls). Never use Description or Helper text as the only accessible name.
|
|
36
|
+
- For complex controls in the content slot (ToggleButtonGroup, InputRange, ImageUploader, Drag&Drop Uploader), wrap them in a role=*"group"* with aria-labelledby pointing to the FieldGroup's label element.
|
|
37
|
+
- When Helper text shows an error, wrap it in an aria-live=*"polite"* region so screen readers announce the error when it appears without requiring navigation. Also link it via aria-describedby on the control so it is read when the control receives focus.
|
|
38
|
+
- Mark required fields with aria-required=*"true"* on the embedded control, in addition to the visual asterisk on the label.
|
|
39
|
+
- When Description=true, associate the description text with the control via aria-describedby alongside the helper text. Both are supplementary — only the label is mandatory for an accessible name.
|
|
40
|
+
- Ensure colour is not the only way to distinguish the error state — the error message in helper text provides the text-based signal required by WCAG 1.4.1 (Use of Colour).
|
|
11
41
|
<!-- END:xui-mcp-instructions:field-group -->
|
|
12
42
|
|
|
13
43
|
## Installation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-field-group",
|
|
3
|
-
"version": "0.189.
|
|
3
|
+
"version": "0.189.3",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
"test:coverage": "vitest run --coverage"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@xsolla/xui-core": "0.189.
|
|
17
|
-
"@xsolla/xui-primitives-core": "0.189.
|
|
16
|
+
"@xsolla/xui-core": "0.189.3",
|
|
17
|
+
"@xsolla/xui-primitives-core": "0.189.3"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": ">=16.8.0",
|