Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

refactor(web): Move `Switch` to design-system folder (#14653)

Ben Bachema0f727511c19
diff --git a/web/src/components/ModelParameters/index.tsx b/web/src/components/ModelParameters/index.tsx
index 1e99667609..344fe0a766 100644
--- a/web/src/components/ModelParameters/index.tsx
+++ b/web/src/components/ModelParameters/index.tsx
@@ -10,7 +10,6 @@ import {
SelectValue,
} from "@/src/components/ui/select";
import { Slider } from "@/src/components/ui/slider";
-import { Switch } from "@/src/components/ui/switch";
import { CreateLLMApiKeyDialog } from "@/src/features/public-api/components/CreateLLMApiKeyDialog";
import useProjectIdFromURL from "@/src/hooks/useProjectIdFromURL";
import { cn } from "@/src/utils/tailwind";
@@ -36,6 +35,7 @@ import {
import { LLMApiKeyComponent } from "./LLMApiKeyComponent";
import { FormDescription } from "@/src/components/ui/form";
import { CodeMirrorEditor } from "../editor";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
export type ModelParamsContext = {
modelParams: UIModelParams;
diff --git a/web/src/components/design-system/Switch/Switch.stories.tsx b/web/src/components/design-system/Switch/Switch.stories.tsx
new file mode 100644
index 0000000000..795923b866
--- /dev/null
+++ b/web/src/components/design-system/Switch/Switch.stories.tsx
@@ -0,0 +1,76 @@
+import React from "react";
+import { fn } from "storybook/test";
+import preview from "../../../../.storybook/preview";
+import { Switch } from "./Switch";
+
+type ComponentProps = React.ComponentProps<typeof Switch>;
+type Size = NonNullable<ComponentProps["size"]>;
+type Color = NonNullable<ComponentProps["color"]>;
+
+const meta = preview.meta({
+ component: Switch,
+ args: {
+ onCheckedChange: fn(),
+ },
+});
+
+const allSizes = Object.keys({
+ default: true,
+ sm: true,
+} satisfies Record<Size, true>) as Size[];
+
+const allColors = Object.keys({
+ default: true,
+ green: true,
+} satisfies Record<Color, true>) as Color[];
+
+export const Default = meta.story({});
+
+export const Checked = meta.story({
+ args: {
+ defaultChecked: true,
+ },
+});
+
+export const Disabled = meta.story({
+ args: {
+ disabled: true,
+ defaultChecked: true,
+ },
+});
+
+export const Small = meta.story({
+ args: {
+ size: "sm",
+ },
+});
+
+export const VariantMatrix = meta.story({
+ parameters: {
+ controls: {
+ disable: true,
+ },
+ },
+ render: () => (
+ <div
+ className="grid gap-4"
+ style={{ gridTemplateColumns: "repeat(2, max-content)" }}
+ >
+ {allSizes.map((size) =>
+ allColors.map((color) => (
+ <div key={`${size}-${color}`} className="flex items-center gap-3">
+ <Switch
+ size={size}
+ color={color}
+ defaultChecked
+ onCheckedChange={fn()}
+ />
+ <div className="text-sm">
+ {size} / {color}
+ </div>
+ </div>
+ )),
+ )}
+ </div>
+ ),
+});
diff --git a/web/src/components/ui/switch.tsx b/web/src/components/design-system/Switch/Switch.tsx
similarity index 73%
rename from web/src/components/ui/switch.tsx
rename to web/src/components/design-system/Switch/Switch.tsx
index 4b4b01aacd..5ebec97bdc 100644
--- a/web/src/components/ui/switch.tsx
+++ b/web/src/components/design-system/Switch/Switch.tsx
@@ -7,16 +7,21 @@ import { cva, type VariantProps } from "class-variance-authority";
import { cn } from "@/src/utils/tailwind";
const switchVariants = cva(
- "peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-muted-foreground",
+ "peer inline-flex shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=unchecked]:bg-input dark:data-[state=unchecked]:bg-muted-foreground",
{
variants: {
size: {
default: "h-5 w-9",
sm: "h-4 w-7",
},
+ color: {
+ default: "data-[state=checked]:bg-primary",
+ green: "data-[state=checked]:bg-dark-green",
+ },
},
defaultVariants: {
size: "default",
+ color: "default",
},
},
);
@@ -36,17 +41,18 @@ const switchThumbVariants = cva(
},
);
-interface SwitchProps
- extends
- React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>,
- VariantProps<typeof switchVariants> {}
+type SwitchProps = Omit<
+ React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root>,
+ "className"
+> &
+ VariantProps<typeof switchVariants>;
const Switch = React.forwardRef<
React.ComponentRef<typeof SwitchPrimitives.Root>,
SwitchProps
->(({ className, size, ...props }, ref) => (
+>(({ size, color, ...props }, ref) => (
<SwitchPrimitives.Root
- className={cn(switchVariants({ size, className }))}
+ className={cn(switchVariants({ size, color }))}
{...props}
ref={ref}
>
diff --git a/web/src/components/session/index.tsx b/web/src/components/session/index.tsx
index 2586568690..61b4862717 100644
--- a/web/src/components/session/index.tsx
+++ b/web/src/components/session/index.tsx
@@ -42,7 +42,7 @@ import { type WithStringifiedMetadata } from "@/src/utils/clientSideDomainTypes"
import { LazyTraceRow } from "@/src/components/session/TraceRow";
import { useParsedTrace } from "@/src/hooks/useParsedTrace";
import useLocalStorage from "@/src/components/useLocalStorage";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { LazySessionTraceEventsRow } from "@/src/components/session/LazySessionTraceEventsRow";
import { observationEventsFilterConfig } from "@/src/features/events/config/filter-config";
import { useEventsFilterOptions } from "@/src/features/events/hooks/useEventsFilterOptions";
@@ -425,11 +425,13 @@ export const SessionPage: React.FC<{
/>
</div>
<div className="flex items-center">
- <Switch
- checked={showCorrections}
- onCheckedChange={setShowCorrectionsForSession}
- className="scale-75"
- />
+ <div className="mx-1">
+ <Switch
+ checked={showCorrections}
+ onCheckedChange={setShowCorrectionsForSession}
+ size="sm"
+ />
+ </div>
<span className="text-muted-foreground text-xs">
Show corrections
</span>
@@ -1018,11 +1020,13 @@ const LoadedSessionEventsPage: React.FC<{
/>
</div>
<div className="flex items-center">
- <Switch
- checked={showCorrections}
- onCheckedChange={setShowCorrectionsForSession}
- className="scale-75"
- />
+ <div className="mx-1">
+ <Switch
+ checked={showCorrections}
+ onCheckedChange={setShowCorrectionsForSession}
+ size="sm"
+ />
+ </div>
<span className="text-muted-foreground text-xs">
Show corrections
</span>
diff --git a/web/src/components/table/peek/peek-evaluator-config-detail.tsx b/web/src/components/table/peek/peek-evaluator-config-detail.tsx
index b7b9bf16d0..90b186b345 100644
--- a/web/src/components/table/peek/peek-evaluator-config-detail.tsx
+++ b/web/src/components/table/peek/peek-evaluator-config-detail.tsx
@@ -12,7 +12,7 @@ import {
import { UserCircle2Icon } from "lucide-react";
import { StatusBadge } from "@/src/components/layouts/status-badge";
import { DeactivateEvalConfig } from "@/src/features/evals/components/deactivate-config";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";
import { useState } from "react";
import { cn } from "@/src/utils/tailwind";
diff --git a/web/src/components/trace/components/IOPreview/components/CorrectedOutputField.tsx b/web/src/components/trace/components/IOPreview/components/CorrectedOutputField.tsx
index e06c915481..458738699a 100644
--- a/web/src/components/trace/components/IOPreview/components/CorrectedOutputField.tsx
+++ b/web/src/components/trace/components/IOPreview/components/CorrectedOutputField.tsx
@@ -8,7 +8,7 @@ import { useCorrectionEditor } from "./hooks/useCorrectionEditor";
import { useMemo, useState } from "react";
import { CodeMirrorEditor } from "@/src/components/editor/CodeMirrorEditor";
import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import useLocalStorage from "@/src/components/useLocalStorage";
import { CorrectedOutputDiffDialog } from "./CorrectedOutputDiffDialog";
import {
@@ -252,12 +252,14 @@ export function CorrectedOutputField({
)}
</div>
<div className="flex items-center">
- <Switch
- checked={strictJsonMode}
- onCheckedChange={handleStrictJsonModeChange}
- disabled={!isEditing}
- className="scale-75"
- />
+ <div className="mx-1">
+ <Switch
+ checked={strictJsonMode}
+ onCheckedChange={handleStrictJsonModeChange}
+ disabled={!isEditing}
+ size="sm"
+ />
+ </div>
<span className="text-muted-foreground text-xs">JSON</span>
</div>
</div>
diff --git a/web/src/components/trace/components/IOPreview/components/ViewModeToggle.tsx b/web/src/components/trace/components/IOPreview/components/ViewModeToggle.tsx
index 0d069bb2ec..12c75031b7 100644
--- a/web/src/components/trace/components/IOPreview/components/ViewModeToggle.tsx
+++ b/web/src/components/trace/components/IOPreview/components/ViewModeToggle.tsx
@@ -1,5 +1,5 @@
import { Tabs, TabsList, TabsTrigger } from "@/src/components/ui/tabs";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { useJsonBetaToggle } from "@/src/components/trace/hooks/useJsonBetaToggle";
export type ViewMode = "pretty" | "json" | "json-beta";
diff --git a/web/src/components/trace/components/ObservationDetailView/ObservationDetailView.tsx b/web/src/components/trace/components/ObservationDetailView/ObservationDetailView.tsx
index 2d2e132643..4375d72fe7 100644
--- a/web/src/components/trace/components/ObservationDetailView/ObservationDetailView.tsx
+++ b/web/src/components/trace/components/ObservationDetailView/ObservationDetailView.tsx
@@ -26,7 +26,7 @@ import {
TabsBarTrigger,
} from "@/src/components/ui/tabs-bar";
import { Tabs, TabsList, TabsTrigger } from "@/src/components/ui/tabs";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import {
Tooltip,
TooltipContent,
diff --git a/web/src/components/trace/components/TraceDetailView/TraceDetailView.tsx b/web/src/components/trace/components/TraceDetailView/TraceDetailView.tsx
index f594667247..7be4506a9f 100644
--- a/web/src/components/trace/components/TraceDetailView/TraceDetailView.tsx
+++ b/web/src/components/trace/components/TraceDetailView/TraceDetailView.tsx
@@ -12,7 +12,7 @@ import {
TabsBarTrigger,
} from "@/src/components/ui/tabs-bar";
import { Tabs, TabsList, TabsTrigger } from "@/src/components/ui/tabs";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { useCallback, useMemo, useState } from "react";
import { type SelectionData } from "@/src/features/comments/contexts/InlineCommentSelectionContext";
import { api } from "@/src/utils/api";
diff --git a/web/src/components/trace/components/TraceSettingsDropdown.tsx b/web/src/components/trace/components/TraceSettingsDropdown.tsx
index bd0fedc4b0..1204ba3ee8 100644
--- a/web/src/components/trace/components/TraceSettingsDropdown.tsx
+++ b/web/src/components/trace/components/TraceSettingsDropdown.tsx
@@ -26,7 +26,7 @@ import {
DropdownMenuSubContent,
DropdownMenuLabel,
} from "@/src/components/ui/dropdown-menu";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { cn } from "@/src/utils/tailwind";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import { useViewPreferences } from "../contexts/ViewPreferencesContext";
@@ -212,7 +212,6 @@ export function TraceViewOptionsMenuItems({
checked={colorCodeMetrics}
onCheckedChange={setColorCodeMetrics}
disabled={!isColorCodeEnabled}
- className={cn(!isColorCodeEnabled && "cursor-not-allowed")}
/>
</div>
</DropdownMenuItem>
diff --git a/web/src/features/automations/components/automationForm.tsx b/web/src/features/automations/components/automationForm.tsx
index f460c4ce1e..4436461321 100644
--- a/web/src/features/automations/components/automationForm.tsx
+++ b/web/src/features/automations/components/automationForm.tsx
@@ -16,7 +16,7 @@ import {
SelectValue,
} from "@/src/components/ui/select";
import { Separator } from "@/src/components/ui/separator";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { useRouter } from "next/router";
import { z } from "zod";
import { type Control, useForm } from "react-hook-form";
diff --git a/web/src/features/datasets/components/DatasetSchemaInput.tsx b/web/src/features/datasets/components/DatasetSchemaInput.tsx
index 93a4f9a913..42fc6b5a2b 100644
--- a/web/src/features/datasets/components/DatasetSchemaInput.tsx
+++ b/web/src/features/datasets/components/DatasetSchemaInput.tsx
@@ -6,7 +6,7 @@ import {
FormLabel,
FormMessage,
} from "@/src/components/ui/form";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { JSONSchemaEditor } from "@/src/components/JSONSchemaEditor";
type DatasetSchemaInputProps = {
diff --git a/web/src/features/datasets/components/MappingCard.tsx b/web/src/features/datasets/components/MappingCard.tsx
index a261ee7bd9..8b03b60be2 100644
--- a/web/src/features/datasets/components/MappingCard.tsx
+++ b/web/src/features/datasets/components/MappingCard.tsx
@@ -12,7 +12,7 @@ import {
type FieldMapping,
} from "@/src/features/datasets/lib/csv/types";
import { isSchemaField } from "@/src/features/datasets/lib/csv/helpers";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { Label } from "@/src/components/ui/label";
import {
Tooltip,
@@ -191,12 +191,14 @@ export function MappingCard({
</h3>
{inputSchemaKeys && inputSchemaKeys.length > 0 && (
<div className="flex items-center gap-1.5">
- <Switch
- id="direct-mapping-input"
- checked={useDirectMappingForInput}
- onCheckedChange={onToggleDirectMappingForInput}
- className="scale-75"
- />
+ <div className="mx-1">
+ <Switch
+ id="direct-mapping-input"
+ checked={useDirectMappingForInput}
+ onCheckedChange={onToggleDirectMappingForInput}
+ size="sm"
+ />
+ </div>
<Label
htmlFor="direct-mapping-input"
className="text-muted-foreground cursor-pointer text-xs font-normal"
@@ -248,12 +250,14 @@ export function MappingCard({
{expectedOutputSchemaKeys &&
expectedOutputSchemaKeys.length > 0 && (
<div className="flex items-center gap-1.5">
- <Switch
- id="direct-mapping-expected"
- checked={useDirectMappingForExpectedOutput}
- onCheckedChange={onToggleDirectMappingForExpectedOutput}
- className="scale-75"
- />
+ <div className="mx-1">
+ <Switch
+ id="direct-mapping-expected"
+ checked={useDirectMappingForExpectedOutput}
+ onCheckedChange={onToggleDirectMappingForExpectedOutput}
+ size="sm"
+ />
+ </div>
<Label
htmlFor="direct-mapping-expected"
className="text-muted-foreground cursor-pointer text-xs font-normal"
diff --git a/web/src/features/evals/components/deactivate-config.tsx b/web/src/features/evals/components/deactivate-config.tsx
index 9521834953..640eba51cc 100644
--- a/web/src/features/evals/components/deactivate-config.tsx
+++ b/web/src/features/evals/components/deactivate-config.tsx
@@ -9,7 +9,7 @@ import {
PopoverTrigger,
} from "@/src/components/ui/popover";
import { Button } from "@/src/components/ui/button";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
export function DeactivateEvalConfig({
projectId,
@@ -64,7 +64,7 @@ export function DeactivateEvalConfig({
evalConfig.timeScope[0] === "EXISTING")
}
checked={isActive}
- className={isActive ? "data-[state=checked]:bg-dark-green" : ""}
+ color="green"
/>
</div>
</PopoverTrigger>
diff --git a/web/src/features/evals/components/eval-template-detail.tsx b/web/src/features/evals/components/eval-template-detail.tsx
index 54079eabc1..187829d1d1 100644
--- a/web/src/features/evals/components/eval-template-detail.tsx
+++ b/web/src/features/evals/components/eval-template-detail.tsx
@@ -14,7 +14,7 @@ import {
import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import Page from "@/src/components/layouts/page";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { Command } from "@/src/components/ui/command";
import { Badge } from "@/src/components/ui/badge";
import { StatusBadge } from "@/src/components/layouts/status-badge";
diff --git a/web/src/features/evals/components/inner-evaluator-form.tsx b/web/src/features/evals/components/inner-evaluator-form.tsx
index faf58a57bd..736f6a9991 100644
--- a/web/src/features/evals/components/inner-evaluator-form.tsx
+++ b/web/src/features/evals/components/inner-evaluator-form.tsx
@@ -46,7 +46,7 @@ import { Slider } from "@/src/components/ui/slider";
import { Card } from "@/src/components/ui/card";
import { usePostHogClientCapture } from "@/src/features/posthog-analytics/usePostHogClientCapture";
import { Checkbox } from "@/src/components/ui/checkbox";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import {
evalConfigFormSchema,
type EvalFormType,
diff --git a/web/src/features/evals/components/variable-mapping-card.tsx b/web/src/features/evals/components/variable-mapping-card.tsx
index 85b7c28c32..627c293fd2 100644
--- a/web/src/features/evals/components/variable-mapping-card.tsx
+++ b/web/src/features/evals/components/variable-mapping-card.tsx
@@ -43,7 +43,7 @@ import {
} from "@/src/components/ui/form";
import { useFieldArray, type UseFormReturn } from "react-hook-form";
import { Input } from "@/src/components/ui/input";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { DetailPageNav } from "@/src/features/navigate-detail-pages/DetailPageNav";
import { useEvalConfigMappingData } from "@/src/features/evals/hooks/useEvalConfigMappingData";
import { useEffect, useState } from "react";
diff --git a/web/src/features/events/components/V4SidebarToggle.tsx b/web/src/features/events/components/V4SidebarToggle.tsx
index 0d01c43a3e..cc0d3040fb 100644
--- a/web/src/features/events/components/V4SidebarToggle.tsx
+++ b/web/src/features/events/components/V4SidebarToggle.tsx
@@ -1,4 +1,4 @@
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { Label } from "@/src/components/ui/label";
import { SidebarMenuButton } from "@/src/components/ui/sidebar";
import {
@@ -127,7 +127,6 @@ export function V4SidebarToggle() {
checked={isBetaEnabled}
onCheckedChange={handleToggle}
disabled={isLoading}
- className="shrink-0"
aria-label="Toggle Preview (fast)"
aria-describedby={PREVIEW_FAST_DESCRIPTION_ID}
/>
diff --git a/web/src/features/experiments/components/RemoteExperimentUpsertForm.tsx b/web/src/features/experiments/components/RemoteExperimentUpsertForm.tsx
index 093f91375b..8cb3c30572 100644
--- a/web/src/features/experiments/components/RemoteExperimentUpsertForm.tsx
+++ b/web/src/features/experiments/components/RemoteExperimentUpsertForm.tsx
@@ -20,7 +20,7 @@ import {
FormMessage,
} from "@/src/components/ui/form";
import { Input } from "@/src/components/ui/input";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { api } from "@/src/utils/api";
import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";
import { showSuccessToast } from "@/src/features/notifications/showSuccessToast";
diff --git a/web/src/features/experiments/components/steps/PromptModelStep.tsx b/web/src/features/experiments/components/steps/PromptModelStep.tsx
index f6bcc0158d..921a01107d 100644
--- a/web/src/features/experiments/components/steps/PromptModelStep.tsx
+++ b/web/src/features/experiments/components/steps/PromptModelStep.tsx
@@ -23,7 +23,7 @@ import {
import { ChevronDown, CheckIcon, PlusIcon, EyeIcon } from "lucide-react";
import { CreateOrEditLLMSchemaDialog } from "@/src/features/playground/page/components/CreateOrEditLLMSchemaDialog";
import { type LlmSchema } from "@langfuse/shared";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { api } from "@/src/utils/api";
import { CardDescription } from "@/src/components/ui/card";
import { cn } from "@/src/utils/tailwind";
diff --git a/web/src/features/feature-previews/components/FeaturePreviewModal.tsx b/web/src/features/feature-previews/components/FeaturePreviewModal.tsx
index 038d166cdc..02187d671c 100644
--- a/web/src/features/feature-previews/components/FeaturePreviewModal.tsx
+++ b/web/src/features/feature-previews/components/FeaturePreviewModal.tsx
@@ -9,7 +9,7 @@ import {
DialogHeader,
DialogTitle,
} from "@/src/components/ui/dialog";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { Button } from "@/src/components/ui/button";
import { cn } from "@/src/utils/tailwind";
diff --git a/web/src/features/notifications/components/NotificationSettings.tsx b/web/src/features/notifications/components/NotificationSettings.tsx
index a57ef37e78..545a24f142 100644
--- a/web/src/features/notifications/components/NotificationSettings.tsx
+++ b/web/src/features/notifications/components/NotificationSettings.tsx
@@ -4,7 +4,7 @@ import { api } from "@/src/utils/api";
import Header from "@/src/components/layouts/header";
import { Card, CardContent } from "@/src/components/ui/card";
import { Label } from "@/src/components/ui/label";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { useHasProjectAccess } from "@/src/features/rbac/utils/checkProjectAccess";
export function NotificationSettings() {
diff --git a/web/src/features/organizations/components/AIFeatureSwitch.tsx b/web/src/features/organizations/components/AIFeatureSwitch.tsx
index 1fdcf6ef79..90d161268d 100644
--- a/web/src/features/organizations/components/AIFeatureSwitch.tsx
+++ b/web/src/features/organizations/components/AIFeatureSwitch.tsx
@@ -1,5 +1,5 @@
import { Button } from "@/src/components/ui/button";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { api } from "@/src/utils/api";
import { useEffect, useState } from "react";
import {
diff --git a/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx b/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx
index c0fe3f0aa0..12bd045112 100644
--- a/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx
+++ b/web/src/features/playground/page/components/JumpToPlaygroundButton.tsx
@@ -12,7 +12,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from "@/src/components/ui/dropdown-menu";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { usePersistedWindowIds } from "@/src/features/playground/page/hooks/usePersistedWindowIds";
import {
type PlaygroundCache,
diff --git a/web/src/features/playground/page/components/Messages.tsx b/web/src/features/playground/page/components/Messages.tsx
index 256f9832f8..db61f13cf6 100644
--- a/web/src/features/playground/page/components/Messages.tsx
+++ b/web/src/features/playground/page/components/Messages.tsx
@@ -6,7 +6,7 @@ import {
DropdownMenuItem,
DropdownMenuTrigger,
} from "@/src/components/ui/dropdown-menu";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { Settings } from "lucide-react";
import useLocalStorage from "@/src/components/useLocalStorage";
import { env } from "@/src/env.mjs";
diff --git a/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx b/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx
index 66c6142e8c..ca636e4573 100644
--- a/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx
+++ b/web/src/features/public-api/components/CreateLLMApiKeyForm.tsx
@@ -31,7 +31,7 @@ import {
SelectTrigger,
SelectValue,
} from "@/src/components/ui/select";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { Tabs, TabsList, TabsTrigger } from "@/src/components/ui/tabs";
import { api, type RouterOutputs } from "@/src/utils/api";
import { cn } from "@/src/utils/tailwind";
diff --git a/web/src/features/web-callouts/components/WebCalloutSettingsPage.tsx b/web/src/features/web-callouts/components/WebCalloutSettingsPage.tsx
index 551e0d19b0..30796f7a12 100644
--- a/web/src/features/web-callouts/components/WebCalloutSettingsPage.tsx
+++ b/web/src/features/web-callouts/components/WebCalloutSettingsPage.tsx
@@ -30,7 +30,7 @@ import {
FormMessage,
} from "@/src/components/ui/form";
import { Input } from "@/src/components/ui/input";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import {
Table,
TableBody,
diff --git a/web/src/pages/project/[projectId]/datasets/[datasetId]/items/[itemId]/index.tsx b/web/src/pages/project/[projectId]/datasets/[datasetId]/items/[itemId]/index.tsx
index ea51299d8c..92cb77ebfd 100644
--- a/web/src/pages/project/[projectId]/datasets/[datasetId]/items/[itemId]/index.tsx
+++ b/web/src/pages/project/[projectId]/datasets/[datasetId]/items/[itemId]/index.tsx
@@ -8,7 +8,7 @@ import { DatasetVersionWarningBanner } from "@/src/features/datasets/components/
import { api } from "@/src/utils/api";
import { useDatasetVersion } from "@/src/features/datasets/hooks/useDatasetVersion";
import { toDatasetSchema } from "@/src/features/datasets/utils/datasetItemUtils";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { Label } from "@/src/components/ui/label";
import { Button } from "@/src/components/ui/button";
import useSessionStorage from "@/src/components/useSessionStorage";
diff --git a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx
index a4b11983ea..e06564edf2 100644
--- a/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx
+++ b/web/src/pages/project/[projectId]/settings/integrations/blobstorage.tsx
@@ -13,7 +13,7 @@ import {
} from "@/src/components/ui/form";
import { Input } from "@/src/components/ui/input";
import { PasswordInput } from "@/src/components/ui/password-input";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import { Checkbox } from "@/src/components/ui/checkbox";
import {
Select,
@@ -561,11 +561,12 @@ const BlobStorageIntegrationSettingsForm = ({
<FormItem>
<FormLabel>Force Path Style</FormLabel>
<FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- className="mt-1 ml-4"
- />
+ <div className="mt-1 ml-4">
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </div>
</FormControl>
<FormDescription>
Enable for MinIO and some other S3 compatible providers
@@ -979,11 +980,12 @@ const BlobStorageIntegrationSettingsForm = ({
<FormItem>
<FormLabel>Gzip Compression</FormLabel>
<FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- className="mt-1 ml-4"
- />
+ <div className="mt-1 ml-4">
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </div>
</FormControl>
<FormDescription>
Compress exported files with gzip (.csv.gz, .json.gz,
@@ -1002,11 +1004,12 @@ const BlobStorageIntegrationSettingsForm = ({
<FormItem>
<FormLabel>Enabled</FormLabel>
<FormControl>
- <Switch
- checked={field.value}
- onCheckedChange={field.onChange}
- className="mt-1 ml-4"
- />
+ <div className="mt-1 ml-4">
+ <Switch
+ checked={field.value}
+ onCheckedChange={field.onChange}
+ />
+ </div>
</FormControl>
<FormMessage />
</FormItem>
diff --git a/web/src/pages/project/[projectId]/settings/integrations/mixpanel.tsx b/web/src/pages/project/[projectId]/settings/integrations/mixpanel.tsx
index 5efb1f9774..4b6e67f2e9 100644
--- a/web/src/pages/project/[projectId]/settings/integrations/mixpanel.tsx
+++ b/web/src/pages/project/[projectId]/settings/integrations/mixpanel.tsx
@@ -13,7 +13,7 @@ import {
FormMessage,
} from "@/src/components/ui/form";
import { PasswordInput } from "@/src/components/ui/password-input";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import {
Select,
SelectContent,
@@ -333,14 +333,15 @@ const MixpanelIntegrationSettingsForm = ({
<FormItem>
<FormLabel>Enabled</FormLabel>
<FormControl>
- <Switch
- id="mixpanel-integration-enabled"
- checked={field.value}
- onCheckedChange={() => {
- field.onChange(!field.value);
- }}
- className="mt-1 ml-4"
- />
+ <div className="mt-1 ml-4">
+ <Switch
+ id="mixpanel-integration-enabled"
+ checked={field.value}
+ onCheckedChange={() => {
+ field.onChange(!field.value);
+ }}
+ />
+ </div>
</FormControl>
<FormMessage />
</FormItem>
diff --git a/web/src/pages/project/[projectId]/settings/integrations/posthog.tsx b/web/src/pages/project/[projectId]/settings/integrations/posthog.tsx
index 38cfefc00a..237c32f5ab 100644
--- a/web/src/pages/project/[projectId]/settings/integrations/posthog.tsx
+++ b/web/src/pages/project/[projectId]/settings/integrations/posthog.tsx
@@ -14,7 +14,7 @@ import {
} from "@/src/components/ui/form";
import { Input } from "@/src/components/ui/input";
import { PasswordInput } from "@/src/components/ui/password-input";
-import { Switch } from "@/src/components/ui/switch";
+import { Switch } from "@/src/components/design-system/Switch/Switch";
import {
Select,
SelectContent,
@@ -309,14 +309,15 @@ const PostHogIntegrationSettings = ({
<FormItem>
<FormLabel>Enabled</FormLabel>
<FormControl>
- <Switch
- id="posthog-integration-enabled"
- checked={field.value}
- onCheckedChange={() => {
- field.onChange(!field.value);
- }}
- className="mt-1 ml-4"
- />
+ <div className="mt-1 ml-4">
+ <Switch
+ id="posthog-integration-enabled"
+ checked={field.value}
+ onCheckedChange={() => {
+ field.onChange(!field.value);
+ }}
+ />
+ </div>
</FormControl>
<FormMessage />
</FormItem>