@xsolla/xui-toggle-button-group 0.174.3 → 0.176.0
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 +40 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,6 +1,46 @@
|
|
|
1
1
|
# ToggleButtonGroup
|
|
2
2
|
|
|
3
3
|
A control for picking one or several options from a linear set of closely related options; useful for filtering or sorting.
|
|
4
|
+
<!-- BEGIN:xui-mcp-instructions:toggle-button-group -->
|
|
5
|
+
A group of buttons where one or more options can be selected. Used to switch between modes, apply filters, or pick compact options — both as an immediate inline control and inside a form via Field Group. Not used for navigation.
|
|
6
|
+
|
|
7
|
+
ToggleButtonGroup can be placed inside a Field Group as the content slot. This gives it a label, helper text, and validation message — the same as any other form control. Use this pattern when the selection is part of a form and needs a label or needs to align visually with adjacent fields.
|
|
8
|
+
|
|
9
|
+
Checkbox vs ToggleButtonGroup:
|
|
10
|
+
- Decision guide
|
|
11
|
+
|
|
12
|
+
### When to use
|
|
13
|
+
- When a user needs to select one or more options from a small, fixed set (2–8+ items)
|
|
14
|
+
- To switch between views, display modes, or content filters
|
|
15
|
+
- When options are equal in weight and benefit from a persistent, visible selection state
|
|
16
|
+
- When a compact button-style control fits better than a list of checkboxes
|
|
17
|
+
- Inside a form via Field Group — as a styled alternative to radio buttons or checkboxes
|
|
18
|
+
|
|
19
|
+
### When not to use
|
|
20
|
+
- When the choice triggers a navigation change — use Tabs
|
|
21
|
+
- For a single binary on/off toggle — use a Switch
|
|
22
|
+
- When there are more options than fit comfortably in a row
|
|
23
|
+
- When options are numerous, have descriptions, or need a long vertical list — use a Context-menu with Checkboxes
|
|
24
|
+
|
|
25
|
+
### Content guidelines
|
|
26
|
+
- Keep item labels short — one word or a brief noun phrase (e.g. Day, Week, Month).
|
|
27
|
+
- Use parallel structure across all items in the same group (all nouns, or all verbs).
|
|
28
|
+
- Icons should reinforce the label meaning; avoid using icons that require the label to be understood.
|
|
29
|
+
- If using icon-only items (no label), ensure all icons are recognizable and add a tooltip.
|
|
30
|
+
|
|
31
|
+
### Behaviour guidelines
|
|
32
|
+
- Clicking an item toggles it between Active and Default.
|
|
33
|
+
- The group supports both single-select (one active at a time) and multi-select (multiple active simultaneously) — the selection model is defined at the product level, not by the component itself.
|
|
34
|
+
- A Disable item cannot be clicked and cannot receive Active state.
|
|
35
|
+
- The group does not close or collapse on selection — it remains fully visible.
|
|
36
|
+
|
|
37
|
+
### Accessibility
|
|
38
|
+
- When used as a single-select control, the group should use role=*"radiogroup"* and each item role=*"radio"* with aria-checked.
|
|
39
|
+
- When used as a multi-select control, each item should use role=*"checkbox"* with aria-checked.
|
|
40
|
+
- Apply aria-disabled=*"true"* to disabled items.
|
|
41
|
+
- Provide an accessible label on the group via aria-label or aria-labelledby.
|
|
42
|
+
- Focus should be manageable via arrow keys within the group (roving tabindex pattern).
|
|
43
|
+
<!-- END:xui-mcp-instructions:toggle-button-group -->
|
|
4
44
|
|
|
5
45
|
## Installation
|
|
6
46
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xsolla/xui-toggle-button-group",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.176.0",
|
|
4
4
|
"main": "./web/index.js",
|
|
5
5
|
"module": "./web/index.mjs",
|
|
6
6
|
"types": "./web/index.d.ts",
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"build:native": "PLATFORM=native tsup"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@xsolla/xui-core": "0.
|
|
14
|
-
"@xsolla/xui-primitives-core": "0.
|
|
13
|
+
"@xsolla/xui-core": "0.176.0",
|
|
14
|
+
"@xsolla/xui-primitives-core": "0.176.0"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"react": ">=16.8.0",
|