Skip to content

feat: DR-7298 Add switch component#7550

Open
carlagn wants to merge 2 commits intomainfrom
feat/DR-7298-switch
Open

feat: DR-7298 Add switch component#7550
carlagn wants to merge 2 commits intomainfrom
feat/DR-7298-switch

Conversation

@carlagn
Copy link
Contributor

@carlagn carlagn commented Feb 24, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced Switch component with full documentation and comprehensive examples.
    • Supports multiple sizes, disabled states, controlled/uncontrolled modes, accessibility features, and keyboard navigation.
    • Dark mode compatible with form element integration.
  • Chores

    • Added Radix UI dependency.

@vercel
Copy link

vercel bot commented Feb 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
blog Ready Ready Preview, Comment Feb 24, 2026 2:22pm
docs Ready Ready Preview, Comment Feb 24, 2026 2:22pm
eclipse Ready Ready Preview, Comment Feb 24, 2026 2:22pm

Request Review

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 24, 2026

Walkthrough

This pull request introduces a new Switch component to the design system by adding a Radix UI-based implementation, comprehensive MDX documentation with live examples, updating the atoms registry, adding the required radix-ui dependency, and exporting the component from the main API surface.

Changes

Cohort / File(s) Summary
Switch Component Implementation
packages/eclipse/src/components/switch.tsx, packages/eclipse/src/components/index.ts
New Switch component wrapping Radix UI with size variants ("sm" | "default"), state-driven styling, and proper className merging. Component is exported from the main barrel for public API access.
Design System Documentation
apps/eclipse/content/design-system/atoms/switch.mdx, apps/eclipse/content/design-system/atoms/meta.json
New MDX documentation file covering Switch usage, props, accessibility, keyboard support, form integration, dark mode, and multiple examples (BasicSwitch, WithLabel, ControlledSwitch, SwitchSizes, DisabledSwitch). Registry updated to include "switch" in atoms pages list.
Dependencies & Tooling
packages/eclipse/package.json, apps/eclipse/src/app/layout.tsx
Adds radix-ui ^1.4.3 as a runtime dependency. Layout component attributes reformatted across multiple lines without behavioral changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: DR-7298 Add switch component' directly and clearly summarizes the main change: introducing a new Switch component to the codebase.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@carlagn carlagn force-pushed the feat/DR-7298-switch branch from b70d2ba to 320f822 Compare February 24, 2026 12:52
@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

🍈 Lychee Link Check Report

3664 links: ✅ 2994 OK | 🚫 4 errors | 🔀 0 redirects | 👻 664 excluded

❌ Errors

./apps/docs/content/docs.v6/guides/permit-io-access-control.mdx

./apps/docs/content/docs.v6/orm/prisma-client/client-extensions/shared-extensions/permit-rbac.mdx

./apps/docs/content/docs/guides/integrations/permit-io.mdx

./apps/docs/content/docs/orm/prisma-client/client-extensions/shared-extensions/permit-rbac.mdx


Full Statistics Table
Status Count
✅ Successful 2994
🔀 Redirected 0
👻 Excluded 664
🚫 Errors 4
⛔ Unsupported 2
⏳ Timeouts 0
❓ Unknown 0

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/eclipse/content/design-system/atoms/switch.mdx`:
- Around line 467-477: The doc's styling tokens/sizes for the Switch component
are out of sync with the implementation; inspect the Switch component
implementation (named Switch) and either update this MDX (switch.mdx) to match
the actual classes (e.g., replace bg-input/bg-primary/thumb tokens with the
current bg-background-neutral-* classes and the actual Tailwind size utilities
used for heights/widths and thumb sizes) or change the component to use the
documented design tokens (bg-input, bg-primary, bg-background,
bg-primary-foreground, ring-ring/50, rounded-full, and the exact pixel sizes for
sm/default); ensure the MDX lists the same token names and pixel dimensions as
the component's classnames and that the focus ring, border (transparent with
shadow), and size variants (sm/default) exactly match the implementation.
- Around line 12-24: The examples render an unlabeled Switch which is
inaccessible; update the BasicSwitch component and the live example to provide
an accessible label by either passing an aria-label prop to the Switch (e.g.,
aria-label="Enable feature") or pairing the Switch with an explicit label
element and id. Specifically modify the BasicSwitch function (export function
BasicSwitch) to render <Switch aria-label="..."> (or wrap Switch with a <label
htmlFor="..."> and give the Switch an id) and update the inline Live Example
<Switch /> inside the demo div the same way so both examples show accessible
usage.

In `@packages/eclipse/src/components/switch.tsx`:
- Around line 14-27: The small variant lacks size classes so
SwitchPrimitive.Root and SwitchPrimitive.Thumb render without dimensions; add
matching data-[size=sm] rules alongside the existing data-[size=default] ones:
on SwitchPrimitive.Root add data-[size=sm]:h-... and data-[size=sm]:w-... (and
any disabled/outline equivalents) and on SwitchPrimitive.Thumb add
data-[size=sm] sizing (width/height) and adjust the translate-x for
data-[state=checked] for the sm thumb to correctly move to the end; update the
cn calls where data-[size=default] appears to include the corresponding
data-[size=sm] tokens so the small variant gets proper root and thumb dimensions
and translations.
- Around line 1-4: Add the client directive and correct Radix import: this file
uses the Radix Switch primitive so add "use client" as the first line of
packages/eclipse/src/components/switch.tsx, and change the import from
"radix-ui" to the scoped package "@radix-ui/react-switch" (the existing import
alias SwitchPrimitive should be preserved), ensuring the Switch component and
any references to SwitchPrimitive continue to work with the updated import.
- Line 2: Replace the import of SwitchPrimitive from the aggregator "radix-ui"
with the scoped package "@radix-ui/react-switch" and add
"@radix-ui/react-switch" to package.json dependencies; specifically update the
import statement that currently reads like `import { Switch as SwitchPrimitive }
from "radix-ui";` to import from "@radix-ui/react-switch" and run your package
install so SwitchPrimitive resolves the same way as other components
(tooltip/dialog/checkbox) in the codebase.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b2427d3 and b70d2ba.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (6)
  • apps/eclipse/content/design-system/atoms/meta.json
  • apps/eclipse/content/design-system/atoms/switch.mdx
  • apps/eclipse/src/app/layout.tsx
  • packages/eclipse/package.json
  • packages/eclipse/src/components/index.ts
  • packages/eclipse/src/components/switch.tsx

Comment on lines +12 to +24
```tsx
import { Switch } from "@prisma-docs/eclipse";

export function BasicSwitch() {
return <Switch />;
}
```

**Live Example:**

<div className="flex gap-4 my-4">
<Switch />
</div>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add accessible labeling to the basic examples.
The basic example and live example render an unlabeled Switch, which is an a11y anti-pattern. Add aria-label (or pair with a label) so examples don’t teach unsafe usage.

✅ Suggested updates
 export function BasicSwitch() {
-  return <Switch />;
+  return <Switch aria-label="Enable feature" />;
 }
@@
 <div className="flex gap-4 my-4">
-  <Switch />
+  <Switch aria-label="Enable feature" />
 </div>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/eclipse/content/design-system/atoms/switch.mdx` around lines 12 - 24,
The examples render an unlabeled Switch which is inaccessible; update the
BasicSwitch component and the live example to provide an accessible label by
either passing an aria-label prop to the Switch (e.g., aria-label="Enable
feature") or pairing the Switch with an explicit label element and id.
Specifically modify the BasicSwitch function (export function BasicSwitch) to
render <Switch aria-label="..."> (or wrap Switch with a <label htmlFor="...">
and give the Switch an id) and update the inline Live Example <Switch /> inside
the demo div the same way so both examples show accessible usage.

Comment on lines +467 to +477
The Switch component uses Eclipse design tokens:

- **Unchecked background**: `bg-input`
- **Checked background**: `bg-primary`
- **Thumb**: `bg-background` (unchecked), `bg-primary-foreground` (checked in dark mode)
- **Focus ring**: `ring-ring/50` with 3px width
- **Border**: Transparent with shadow
- **Sizes**:
- Small (`sm`): 14px height × 24px width, 12px thumb
- Default: ~18px height × 32px width, 16px thumb
- **Border radius**: Fully rounded (`rounded-full`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Verify the styling tokens/sizes match the implementation.
The styling section mentions bg-input, bg-primary, and specific pixel sizes, but the component currently uses bg-background-neutral-* and different size utilities. Please align docs with the real classes/tokens to avoid confusion.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/eclipse/content/design-system/atoms/switch.mdx` around lines 467 - 477,
The doc's styling tokens/sizes for the Switch component are out of sync with the
implementation; inspect the Switch component implementation (named Switch) and
either update this MDX (switch.mdx) to match the actual classes (e.g., replace
bg-input/bg-primary/thumb tokens with the current bg-background-neutral-*
classes and the actual Tailwind size utilities used for heights/widths and thumb
sizes) or change the component to use the documented design tokens (bg-input,
bg-primary, bg-background, bg-primary-foreground, ring-ring/50, rounded-full,
and the exact pixel sizes for sm/default); ensure the MDX lists the same token
names and pixel dimensions as the component's classnames and that the focus
ring, border (transparent with shadow), and size variants (sm/default) exactly
match the implementation.

Comment on lines +1 to +4
import * as React from "react";
import { Switch as SwitchPrimitive } from "radix-ui";

import { cn } from "../lib/cn";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

# Search for "use client" directives in component files
rg -n '"use client"' packages/eclipse/src/components/ --type tsx

Repository: prisma/web

Length of output: 81


🏁 Script executed:

# Check the structure of other components to understand the pattern
fd '\.tsx$' packages/eclipse/src/components/ | head -10

Repository: prisma/web

Length of output: 492


🏁 Script executed:

# Examine one or two other component files to see if they use "use client"
ls -la packages/eclipse/src/components/ | head -20

Repository: prisma/web

Length of output: 1201


🏁 Script executed:

# Search for "use client" directive in components directory without type restriction
rg '"use client"' packages/eclipse/src/components/

Repository: prisma/web

Length of output: 1248


🏁 Script executed:

# Examine a few component files to see if they have "use client" directive
cat packages/eclipse/src/components/checkbox.tsx

Repository: prisma/web

Length of output: 1771


🏁 Script executed:

# Check another Radix-based component
cat packages/eclipse/src/components/accordion.tsx

Repository: prisma/web

Length of output: 3056


🏁 Script executed:

# Read the switch.tsx file to verify its content
cat packages/eclipse/src/components/switch.tsx

Repository: prisma/web

Length of output: 1520


🏁 Script executed:

# Search for any usage of Switch from radix-ui to understand if this is a typo
rg 'from.*radix-ui' packages/eclipse/src/components/ | grep -v '@radix-ui'

Repository: prisma/web

Length of output: 150


🏁 Script executed:

# Search for any file that might be exporting from radix-ui (barrel export)
rg 'export.*from.*@radix-ui' packages/eclipse/src/ | head -20

Repository: prisma/web

Length of output: 36


🏁 Script executed:

# Check if there's an index or barrel file in node_modules or package.json that exports radix-ui
rg 'radix-ui' packages/eclipse/ -g '*.json' -g '*.ts' -g '*.tsx' | grep -i 'package\|export\|from.*radix'

Repository: prisma/web

Length of output: 2663


🏁 Script executed:

# Check the actual Switch component usage - is SwitchPrimitive.Root a valid export from "radix-ui"?
rg 'SwitchPrimitive\.Root' packages/eclipse/src/

Repository: prisma/web

Length of output: 293


Add "use client" directive and fix the Radix Switch import path.

This component uses Radix Switch primitives, which are client-only. The missing "use client" directive will cause Next.js import errors when consumed from React Server Components or MDX. Additionally, the import from "radix-ui" is non-standard—all other Radix components in the codebase use scoped imports (e.g., @radix-ui/react-checkbox). The Switch component should import from @radix-ui/react-switch to match the established pattern and ensure correct module resolution.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/eclipse/src/components/switch.tsx` around lines 1 - 4, Add the
client directive and correct Radix import: this file uses the Radix Switch
primitive so add "use client" as the first line of
packages/eclipse/src/components/switch.tsx, and change the import from
"radix-ui" to the scoped package "@radix-ui/react-switch" (the existing import
alias SwitchPrimitive should be preserved), ensuring the Switch component and
any references to SwitchPrimitive continue to work with the updated import.

@@ -0,0 +1,33 @@
import * as React from "react";
import { Switch as SwitchPrimitive } from "radix-ui";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's check the actual file and its imports
cat -n packages/eclipse/src/components/switch.tsx | head -20

Repository: prisma/web

Length of output: 1180


🏁 Script executed:

# Check the package.json to understand dependencies
cat packages/eclipse/package.json

Repository: prisma/web

Length of output: 1739


🏁 Script executed:

# Search for other radix-ui imports in the project to understand the pattern
rg "from.*radix-ui" packages/eclipse/src/ -A 1

Repository: prisma/web

Length of output: 2488


🌐 Web query:

radix-ui npm package exports what components

💡 Result:

The radix-ui package’s main entry (import { … } from "radix-ui") re-exports these component namespaces (each is the * as namespace from the corresponding @radix-ui/react-* package) [1]:

  • AccessibleIcon
  • Accordion
  • AlertDialog
  • AspectRatio
  • Avatar
  • Checkbox
  • Collapsible
  • ContextMenu
  • Dialog
  • Direction
  • DropdownMenu
  • Form
  • HoverCard
  • Label
  • Menubar
  • NavigationMenu
  • Popover
  • Portal
  • Progress
  • RadioGroup
  • ScrollArea
  • Select
  • Separator
  • Slider
  • Slot
  • Switch
  • Tabs
  • Toast
  • Toggle
  • ToggleGroup
  • Toolbar
  • Tooltip
  • VisuallyHidden
  • unstable_OneTimePasswordField
  • unstable_PasswordToggleField [1]

Example usage (from the Radix docs): import { Dialog } from "radix-ui"; [2]

Sources: [1] [2]


🌐 Web query:

@radix-ui/react-switch npm package Switch.Root Switch.Thumb

💡 Result:

@radix-ui/react-switch exports an accessible, unstyled Switch primitive composed of two main parts:

  • Switch.Root: the interactive switch “button” (holds state, focus/keyboard behavior, form integration). It exposes props like checked, defaultChecked, onCheckedChange, disabled, required, name, value, and data attributes like data-state="checked|unchecked". [1]
  • Switch.Thumb: the visual thumb/knob inside the root; it also receives data-state / data-disabled for styling. [1]

Install

npm i `@radix-ui/react-switch`

[2]

Basic usage

import * as Switch from "@radix-ui/react-switch";

export function MySwitch() {
  return (
    <Switch.Root className="SwitchRoot" id="airplane-mode">
      <Switch.Thumb className="SwitchThumb" />
    </Switch.Root>
  );
}

[1]

Controlled usage

import * as Switch from "@radix-ui/react-switch";
import * as React from "react";

export function Controlled() {
  const [checked, setChecked] = React.useState(false);
  return (
    <Switch.Root checked={checked} onCheckedChange={setChecked}>
      <Switch.Thumb />
    </Switch.Root>
  );
}

[1]

Sources: Radix Switch docs [1], npm package page [2].


Use the scoped @radix-ui/react-switch package for consistency with the rest of the codebase.

The radix-ui aggregator package does re-export Switch, so the current import works. However, every other component in this project (tooltip, dialog, checkbox, separator, etc.) imports from the scoped @radix-ui/react-* packages. For consistency and clarity, add @radix-ui/react-switch to dependencies and update the import pattern:

Recommended change
-import { Switch as SwitchPrimitive } from "radix-ui";
+import * as SwitchPrimitive from "@radix-ui/react-switch";
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/eclipse/src/components/switch.tsx` at line 2, Replace the import of
SwitchPrimitive from the aggregator "radix-ui" with the scoped package
"@radix-ui/react-switch" and add "@radix-ui/react-switch" to package.json
dependencies; specifically update the import statement that currently reads like
`import { Switch as SwitchPrimitive } from "radix-ui";` to import from
"@radix-ui/react-switch" and run your package install so SwitchPrimitive
resolves the same way as other components (tooltip/dialog/checkbox) in the
codebase.

Comment on lines +14 to +27
<SwitchPrimitive.Root
data-slot="switch"
data-size={size}
className={cn(
"peer data-[state=checked]:bg-background-neutral-reverse data-[state=unchecked]:bg-background-neutral-strong focus-visible:border-ring group/switch inline-flex shrink-0 items-center rounded-circle border-1 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed data-[size=default]:h-[1.15rem] data-[size=default]:w-8 disabled:outline-stroke-neutral-weak disabled:outline disabled:outline-solid disabled:bg-background-neutral-weak disabled:[&>span]:bg-foreground-neutral-weaker [&>span]:bg-foreground-neutral-reverse",
className,
)}
{...props}
>
<SwitchPrimitive.Thumb
data-slot="switch-thumb"
className={cn(
"dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-3 data-[state=checked]:translate-x-[calc(100%+3px)] data-[state=unchecked]:translate-x-[2px] disabled:bg-foreground-neutral-weaker",
)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

size="sm" currently has no dimensions.
Only data-[size=default] is styled, so the small variant renders without width/height and the thumb has no size. Add data-[size=sm] sizing for both root and thumb (and adjust translations if needed).

🧩 Example sizing additions for the sm variant
       className={cn(
-        "peer data-[state=checked]:bg-background-neutral-reverse data-[state=unchecked]:bg-background-neutral-strong focus-visible:border-ring  group/switch inline-flex shrink-0 items-center rounded-circle border-1 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed data-[size=default]:h-[1.15rem] data-[size=default]:w-8 disabled:outline-stroke-neutral-weak disabled:outline disabled:outline-solid disabled:bg-background-neutral-weak disabled:[&>span]:bg-foreground-neutral-weaker [&>span]:bg-foreground-neutral-reverse",
+        "peer data-[state=checked]:bg-background-neutral-reverse data-[state=unchecked]:bg-background-neutral-strong focus-visible:border-ring  group/switch inline-flex shrink-0 items-center rounded-circle border-1 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 disabled:outline-stroke-neutral-weak disabled:outline disabled:outline-solid disabled:bg-background-neutral-weak disabled:[&>span]:bg-foreground-neutral-weaker [&>span]:bg-foreground-neutral-reverse",
         className,
       )}
@@
       <SwitchPrimitive.Thumb
         data-slot="switch-thumb"
         className={cn(
-          "dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-3 data-[state=checked]:translate-x-[calc(100%+3px)] data-[state=unchecked]:translate-x-[2px] disabled:bg-foreground-neutral-weaker",
+          "dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-3 group-data-[size=sm]/switch:size-2.5 data-[state=checked]:translate-x-[calc(100%+3px)] data-[state=unchecked]:translate-x-[2px] disabled:bg-foreground-neutral-weaker",
         )}
       />
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<SwitchPrimitive.Root
data-slot="switch"
data-size={size}
className={cn(
"peer data-[state=checked]:bg-background-neutral-reverse data-[state=unchecked]:bg-background-neutral-strong focus-visible:border-ring group/switch inline-flex shrink-0 items-center rounded-circle border-1 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed data-[size=default]:h-[1.15rem] data-[size=default]:w-8 disabled:outline-stroke-neutral-weak disabled:outline disabled:outline-solid disabled:bg-background-neutral-weak disabled:[&>span]:bg-foreground-neutral-weaker [&>span]:bg-foreground-neutral-reverse",
className,
)}
{...props}
>
<SwitchPrimitive.Thumb
data-slot="switch-thumb"
className={cn(
"dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-3 data-[state=checked]:translate-x-[calc(100%+3px)] data-[state=unchecked]:translate-x-[2px] disabled:bg-foreground-neutral-weaker",
)}
<SwitchPrimitive.Root
data-slot="switch"
data-size={size}
className={cn(
"peer data-[state=checked]:bg-background-neutral-reverse data-[state=unchecked]:bg-background-neutral-strong focus-visible:border-ring group/switch inline-flex shrink-0 items-center rounded-circle border-1 border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed data-[size=default]:h-[1.15rem] data-[size=default]:w-8 data-[size=sm]:h-3.5 data-[size=sm]:w-6 disabled:outline-stroke-neutral-weak disabled:outline disabled:outline-solid disabled:bg-background-neutral-weak disabled:[&>span]:bg-foreground-neutral-weaker [&>span]:bg-foreground-neutral-reverse",
className,
)}
{...props}
>
<SwitchPrimitive.Thumb
data-slot="switch-thumb"
className={cn(
"dark:data-[state=checked]:bg-primary-foreground pointer-events-none block rounded-full ring-0 transition-transform group-data-[size=default]/switch:size-3 group-data-[size=sm]/switch:size-2.5 data-[state=checked]:translate-x-[calc(100%+3px)] data-[state=unchecked]:translate-x-[2px] disabled:bg-foreground-neutral-weaker",
)}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/eclipse/src/components/switch.tsx` around lines 14 - 27, The small
variant lacks size classes so SwitchPrimitive.Root and SwitchPrimitive.Thumb
render without dimensions; add matching data-[size=sm] rules alongside the
existing data-[size=default] ones: on SwitchPrimitive.Root add
data-[size=sm]:h-... and data-[size=sm]:w-... (and any disabled/outline
equivalents) and on SwitchPrimitive.Thumb add data-[size=sm] sizing
(width/height) and adjust the translate-x for data-[state=checked] for the sm
thumb to correctly move to the end; update the cn calls where
data-[size=default] appears to include the corresponding data-[size=sm] tokens
so the small variant gets proper root and thumb dimensions and translations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant