@versini/ui-togglegroup 4.0.8 → 4.0.10

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 CHANGED
@@ -1,17 +1,28 @@
1
1
  # @versini/ui-togglegroup
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@versini/ui-togglegroup?style=flat-square)](https://www.npmjs.com/package/@versini/ui-togglegroup)
4
+ ![npm package minimized gzipped size](<https://img.shields.io/bundlejs/size/%40versini%2Fui-togglegroup?style=flat-square&label=size%20(gzip)>)
4
5
 
5
6
  > An accessible React toggle button group component built with TypeScript and TailwindCSS.
6
7
 
7
- The ToggleGroup component provides grouped toggle buttons for single or multiple selections with proper accessibility and keyboard navigation.
8
-
8
+ The ToggleGroup component provides grouped toggle buttons for single-select usage with proper accessibility, typeahead support (via Radix), theming, sizing and focus management.
9
9
 
10
10
  ## Table of Contents
11
11
 
12
12
  - [Features](#features)
13
13
  - [Installation](#installation)
14
14
  - [Usage](#usage)
15
+ - [Examples](#examples)
16
+ - [API](#api)
17
+
18
+ ## Features
19
+
20
+ - **🔢 Grouped Selection**: Manage a set of related options with single selection
21
+ - **♿ Accessible**: Built atop Radix primitives with robust a11y patterns
22
+ - **🎨 Theming & Sizes**: Supports light/dark/system modes & `small | medium | large` sizes
23
+ - **🎯 Focus Styles**: Independent `focusMode` to align with design tokens
24
+ - **⌨️ Keyboard Friendly**: Arrow key navigation & typeahead labeling
25
+ - **🧪 Type Safe**: Strongly typed props and context sharing
15
26
 
16
27
  ## Installation
17
28
 
@@ -19,7 +30,7 @@ The ToggleGroup component provides grouped toggle buttons for single or multiple
19
30
  npm install @versini/ui-togglegroup
20
31
  ```
21
32
 
22
- > **Note**: This component requires TailwindCSS and the `@versini/ui-styles` plugin for proper styling. See the [root README](../../README.md#tailwindcss-setup) for complete setup instructions.
33
+ > **Note**: This component requires TailwindCSS and the `@versini/ui-styles` plugin for proper styling. See the [installation documentation](https://versini-org.github.io/ui-components/?path=/docs/getting-started-installation--docs) for complete setup instructions.
23
34
 
24
35
  ## Usage
25
36
 
@@ -28,7 +39,7 @@ import { ToggleGroup } from "@versini/ui-togglegroup";
28
39
 
29
40
  function App() {
30
41
  const [selected, setSelected] = useState("left");
31
-
42
+
32
43
  return (
33
44
  <ToggleGroup
34
45
  value={selected}
@@ -42,3 +53,57 @@ function App() {
42
53
  );
43
54
  }
44
55
  ```
56
+
57
+ ## Examples
58
+
59
+ ### Large Size Group
60
+
61
+ ```tsx
62
+ <ToggleGroup size="large" value={alignment} onValueChange={setAlignment}>
63
+ <ToggleGroupItem value="left" />
64
+ <ToggleGroupItem value="center" />
65
+ <ToggleGroupItem value="right" />
66
+ </ToggleGroup>
67
+ ```
68
+
69
+ ### Themed Group (Dark)
70
+
71
+ ```tsx
72
+ <ToggleGroup
73
+ mode="dark"
74
+ focusMode="light"
75
+ value={theme}
76
+ onValueChange={setTheme}
77
+ >
78
+ <ToggleGroupItem value="auto" />
79
+ <ToggleGroupItem value="light" />
80
+ <ToggleGroupItem value="dark" />
81
+ </ToggleGroup>
82
+ ```
83
+
84
+ ## API
85
+
86
+ ### ToggleGroup Props
87
+
88
+ | Prop | Type | Default | Description |
89
+ | --------------- | ------------------------- | -------- | ----------------------------------------- | ------------- | --------------------- | -------------------------- |
90
+ | `value` | `string` | - | Current selected value (controlled). |
91
+ | `defaultValue` | `string` | - | Initial value (uncontrolled). |
92
+ | `onValueChange` | `(value: string) => void` | - | Fired when selection changes. |
93
+ | `disabled` | `boolean` | - | Disable the entire group. |
94
+ | `mode` | `"dark" | "light" | "system" | "alt-system"` | `"system"` | Color / theme mode. |
95
+ | `focusMode` | `"dark" | "light" | "system" | "alt-system"` | `"system"` | Color mode for focus ring. |
96
+ | `size` | `"small" | "medium" | "large"` | `"medium"` | Visual size of items. |
97
+ | `className` | `string` | - | Extra class(es) applied to container. |
98
+ | `children` | `React.ReactNode` | - | One or more `ToggleGroupItem` components. |
99
+
100
+ > Inherits other valid props from `@radix-ui/react-toggle-group` single variant (except `type`, `defaultValue` already controlled internally).
101
+
102
+ ### ToggleGroupItem Props
103
+
104
+ | Prop | Type | Default | Description |
105
+ | ---------- | --------- | ------- | -------------------------------------- |
106
+ | `value` | `string` | - | Value represented by this toggle item. |
107
+ | `disabled` | `boolean` | - | Disable just this item. |
108
+
109
+ > Item content is the `value` string by default; you can customize by extending the component if needed.
package/dist/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { TOGGLEGROUP_CLASSNAME as E, TOGGLEGROUP_ITEM_CLASSNAME as e, TOGGLEGROUP_ITEM_WRAPPER_CLASSNAME as T, ToggleGroup as i, ToggleGroupItem as r } from "./components/ToggleGroup/ToggleGroup.js";
2
2
  /*!
3
- @versini/ui-togglegroup v4.0.8
3
+ @versini/ui-togglegroup v4.0.10
4
4
  © 2025 gizmette.com
5
5
  */
6
6
  try {
7
7
  window.__VERSINI_UI_TOGGLEGROUP__ || (window.__VERSINI_UI_TOGGLEGROUP__ = {
8
- version: "4.0.8",
9
- buildTime: "08/23/2025 09:08 AM EDT",
8
+ version: "4.0.10",
9
+ buildTime: "08/23/2025 12:22 PM EDT",
10
10
  homepage: "https://github.com/aversini/ui-components",
11
11
  license: "MIT"
12
12
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/ui-togglegroup",
3
- "version": "4.0.8",
3
+ "version": "4.0.10",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {
@@ -52,5 +52,5 @@
52
52
  "sideEffects": [
53
53
  "**/*.css"
54
54
  ],
55
- "gitHead": "7bbfa99a4441ef5b0828a37d190f694e199b663d"
55
+ "gitHead": "d568e20474c6c87f836c4cb6548f2cc0143a353c"
56
56
  }