@datawire-ai/busyfile-design-library 1.25.0 → 1.26.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 CHANGED
@@ -327,30 +327,45 @@ A customizable and accessible `toggle button` (switch) component. Supports both
327
327
  ## Usage
328
328
 
329
329
  ```tsx
330
-
331
330
  // Controlled toggle
332
- <Toggle checked={enabled} onChange={setEnabled} variant="classic" />
331
+ 'use client';
333
332
 
334
- // Uncontrolled toggle
335
- <StatefulToggle defaultChecked={true} variant="classic" />
333
+ import * as React from 'react';
334
+ import { Toggle } from '@/components/ui/toggle-button';
336
335
 
337
- // Disabled toggle
338
- <Toggle checked={true} disabled />
336
+ export default function Example() {
337
+ const [checked, setChecked] = React.useState(false);
338
+
339
+ return (
340
+ <div className="flex items-center gap-3">
341
+ <Toggle
342
+ id="dark-mode"
343
+ checked={checked}
344
+ onCheckedChange={setChecked}
345
+ className="data-[state=checked]:bg-green-500 data-[state=unchecked]:bg-gray-300"
346
+ />
347
+ <label
348
+ htmlFor="dark-mode"
349
+ className="cursor-pointer select-none text-sm font-medium"
350
+ >
351
+ Enable Dark Mode
352
+ </label>
353
+ </div>
354
+ );
355
+ }
339
356
  ```
340
357
 
341
358
  ### Props
342
359
 
343
- | Prop | Type | Default | Description |
344
- | ----------------- | -------------------------------- | ----------- | ----------------------------------------------------------- |
345
- | `checked` | `boolean` | `false` | Whether the toggle is on or off (controlled). |
346
- | `onChange` | `(checked: boolean) => void` | `-` | Callback fired when the toggle changes. |
347
- | `variant` | `"classic"` \| `"modern"` \| ... | `"classic"` | Visual style variant (extend via `toggleVariants`). |
348
- | `disabled` | `boolean` | `false` | Disables the toggle. |
349
- | `className` | `string` | `-` | Additional classes for styling. |
350
- | `id` | `string` | `-` | Optional id for the button element. |
351
- | `name` | `string` | `-` | Optional name (useful for forms). |
352
- | `aria-label` | `string` | `-` | Accessible label (required if no visible label is present). |
353
- | `aria-labelledby` | `string` | `-` | ID of an element labeling the toggle. |
360
+ | Prop | Type | Default | Description |
361
+ | ----------------- | --------------------------------------------------- | ------- | --------------------------------------------------------------- |
362
+ | `checked` | `boolean` | `false` | Controls the switch state (on/off). |
363
+ | `defaultChecked` | `boolean` | `false` | Sets the initial state when using the switch uncontrolled. |
364
+ | `onCheckedChange` | `(checked: boolean) => void` | `—` | Callback function fired when the checked state changes. |
365
+ | `disabled` | `boolean` | `false` | Disables the switch if `true`. |
366
+ | `id` | `string` | `—` | Used to pair the switch with a `<label>` for accessibility. |
367
+ | `className` | `string` | `—` | Apply custom Tailwind/utility classes. |
368
+ | `...props` | `React.ComponentProps<typeof SwitchPrimitive.Root>` | `—` | Any additional props supported by Radix `SwitchPrimitive.Root`. |
354
369
 
355
370
  # Radio Button
356
371