Skip to content

The open alternative to Salesforce, designed for AI.

Migrate twenty-ui Toggle to Switch (#25678)

Raphaël Bosid63910e39892
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx
index 717634ca4df..c0927731c24 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-input-gallery.front-component.tsx
@@ -1,7 +1,6 @@
import { defineFrontComponent } from 'twenty-sdk/define';
import { IconPlus, IconSearch, IconStar, IconTrash } from 'twenty-ui/icon';
import {
- AdvancedSettingsToggle,
AnimatedButton,
AnimatedLightIconButton,
Button,
@@ -33,7 +32,7 @@ import {
StyledTabContainer,
TabButton,
TabContent,
- Toggle,
+ Switch,
} from 'twenty-ui/input';
import { ThemeProvider } from 'twenty-ui/theme-constants';
@@ -43,15 +42,6 @@ import {
} from '../shared/front-components/component-gallery';
const INPUT_ENTRIES: GalleryEntry[] = [
- {
- name: 'AdvancedSettingsToggle',
- node: (
- <AdvancedSettingsToggle
- isAdvancedModeEnabled={false}
- setIsAdvancedModeEnabled={() => {}}
- />
- ),
- },
{
name: 'AnimatedButton',
node: (
@@ -236,8 +226,14 @@ const INPUT_ENTRIES: GalleryEntry[] = [
node: <TabContent id="tc1" title="Content" />,
},
{
- name: 'Toggle',
- node: <Toggle value={false} onChange={() => {}} />,
+ name: 'Switch',
+ node: (
+ <Switch
+ aria-label="Example switch"
+ checked={false}
+ onCheckedChange={() => {}}
+ />
+ ),
},
];
diff --git a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-navigation-gallery.front-component.tsx b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-navigation-gallery.front-component.tsx
index baa23308635..0917619a575 100644
--- a/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-navigation-gallery.front-component.tsx
+++ b/packages/twenty-front-component-renderer/src/__stories__/twenty-ui-gallery/twenty-ui-navigation-gallery.front-component.tsx
@@ -19,7 +19,7 @@ import {
MenuItemSelectColor,
MenuItemSelectTag,
MenuItemSuggestion,
- MenuItemToggle,
+ MenuItemSwitch,
MenuPicker,
NavigationBar,
NavigationBarItem,
@@ -183,9 +183,9 @@ const NAVIGATION_ENTRIES: GalleryEntry[] = [
node: <MenuItemSuggestion text="Suggestion" onClick={() => {}} />,
},
{
- name: 'MenuItemToggle',
+ name: 'MenuItemSwitch',
node: (
- <MenuItemToggle text="Toggle" toggled={true} onToggleChange={() => {}} />
+ <MenuItemSwitch text="Switch" checked={true} onCheckedChange={() => {}} />
),
},
{
diff --git a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx
index a358b05d94f..6cb563e7d7e 100644
--- a/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx
+++ b/packages/twenty-front/src/modules/activities/calendar/components/CalendarEventComposerFields.tsx
@@ -22,11 +22,15 @@ import { DragDropProvider } from '@dnd-kit/react';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { Callout } from 'twenty-ui/feedback';
-import { Toggle } from 'twenty-ui/input';
+import { Switch } from 'twenty-ui/input';
import { themeCssVariables } from 'twenty-ui/theme-constants';
const COMPOSER_LABEL_MIN_WIDTH = '80px';
+const StyledSwitch = styled(Switch)`
+ align-self: center;
+`;
+
const StyledFieldsContainer = styled.div`
display: flex;
flex: 1;
@@ -165,12 +169,11 @@ export const CalendarEventComposerFields = ({
composerState.handleIsFullDayChange(!composerState.isFullDay)
}
trailing={
- <Toggle
+ <StyledSwitch
aria-label={t`All day`}
- toggleSize="small"
- centered
- value={composerState.isFullDay}
- onChange={composerState.handleIsFullDayChange}
+ size="sm"
+ checked={composerState.isFullDay}
+ onCheckedChange={composerState.handleIsFullDayChange}
/>
}
>
@@ -251,12 +254,11 @@ export const CalendarEventComposerFields = ({
composerState.setSendInvitations(!composerState.sendInvitations)
}
trailing={
- <Toggle
+ <StyledSwitch
aria-label={t`Send invitations`}
- toggleSize="small"
- centered
- value={composerState.sendInvitations}
- onChange={composerState.setSendInvitations}
+ size="sm"
+ checked={composerState.sendInvitations}
+ onCheckedChange={composerState.setSendInvitations}
/>
}
>
@@ -271,12 +273,11 @@ export const CalendarEventComposerFields = ({
composerState.setAddConferencing(!composerState.addConferencing)
}
trailing={
- <Toggle
+ <StyledSwitch
aria-label={t`Video conferencing`}
- toggleSize="small"
- centered
- value={composerState.addConferencing}
- onChange={composerState.setAddConferencing}
+ size="sm"
+ checked={composerState.addConferencing}
+ onCheckedChange={composerState.setAddConferencing}
/>
}
>
diff --git a/packages/twenty-front/src/modules/command-menu-item/edit/components/CommandMenuItemOptionsDropdown.tsx b/packages/twenty-front/src/modules/command-menu-item/edit/components/CommandMenuItemOptionsDropdown.tsx
index 91cbcb1c635..6629746468c 100644
--- a/packages/twenty-front/src/modules/command-menu-item/edit/components/CommandMenuItemOptionsDropdown.tsx
+++ b/packages/twenty-front/src/modules/command-menu-item/edit/components/CommandMenuItemOptionsDropdown.tsx
@@ -9,7 +9,7 @@ import { useLingui } from '@lingui/react/macro';
import { type ReactElement } from 'react';
import { isDefined } from 'twenty-shared/utils';
import { IconRefresh, IconTag } from 'twenty-ui/icon';
-import { MenuItem, MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItem, MenuItemSwitch } from 'twenty-ui/navigation';
import { type CommandMenuItemFieldsFragment } from '~/generated-metadata/graphql';
type CommandMenuItemOptionsDropdownProps = Pick<
@@ -43,9 +43,9 @@ export const CommandMenuItemOptionsDropdown = ({
const isLabelHidden =
normalizedShortLabel === null && isDefined(normalizedServerShortLabel);
- const handleToggleHideLabel = (toggled: boolean) => {
+ const handleHiddenLabelChange = (checked: boolean) => {
updateCommandMenuItemInDraft(itemId, {
- shortLabel: toggled ? null : normalizedServerShortLabel,
+ shortLabel: checked ? null : normalizedServerShortLabel,
});
};
@@ -62,12 +62,12 @@ export const CommandMenuItemOptionsDropdown = ({
dropdownComponents={
<DropdownContent widthInPixels={GenericDropdownContentWidth.Medium}>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconTag}
text={t`Hide label`}
- toggled={isLabelHidden || hasNoShortLabel}
- onToggleChange={handleToggleHideLabel}
- toggleSize="small"
+ checked={isLabelHidden || hasNoShortLabel}
+ onCheckedChange={handleHiddenLabelChange}
+ size="sm"
disabled={hasNoShortLabel}
/>
<MenuItem
diff --git a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemToggle.tsx b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemSwitch.tsx
similarity index 71%
rename from packages/twenty-front/src/modules/command-menu/components/CommandMenuItemToggle.tsx
rename to packages/twenty-front/src/modules/command-menu/components/CommandMenuItemSwitch.tsx
index 236ffdecf83..8c193b2ad78 100644
--- a/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemToggle.tsx
+++ b/packages/twenty-front/src/modules/command-menu/components/CommandMenuItemSwitch.tsx
@@ -1,19 +1,19 @@
import { isSelectedItemIdComponentFamilyState } from '@/ui/layout/selectable-list/states/isSelectedItemIdComponentFamilyState';
import { useAtomComponentFamilyStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentFamilyStateValue';
-import { MenuItemToggle, type MenuItemToggleProps } from 'twenty-ui/navigation';
+import { MenuItemSwitch, type MenuItemSwitchProps } from 'twenty-ui/navigation';
-export type CommandMenuItemToggleProps = MenuItemToggleProps & {
+export type CommandMenuItemSwitchProps = MenuItemSwitchProps & {
id: string;
};
-export const CommandMenuItemToggle = (props: CommandMenuItemToggleProps) => {
+export const CommandMenuItemSwitch = (props: CommandMenuItemSwitchProps) => {
const isSelectedItemId = useAtomComponentFamilyStateValue(
isSelectedItemIdComponentFamilyState,
props.id,
);
return (
- <MenuItemToggle
+ <MenuItemSwitch
// oxlint-disable-next-line react/jsx-props-no-spreading
{...props}
focused={isSelectedItemId}
diff --git a/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawerContent.tsx b/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawerContent.tsx
index d1f0c976d8a..5dd2d1f5c09 100644
--- a/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawerContent.tsx
+++ b/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawerContent.tsx
@@ -1,5 +1,6 @@
import { MOBILE_NAVIGATION_BAR_CLEARANCE } from '@/navigation/constants/MobileNavigationBarClearance';
import { SettingsNavigationDrawerItems } from '@/settings/components/SettingsNavigationDrawerItems';
+import { AdvancedSettingsSwitch } from '@/ui/input/components/AdvancedSettingsSwitch';
import { NavigationDrawerScrollableContent } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerScrollableContent';
import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection';
import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState';
@@ -7,11 +8,10 @@ import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { css } from '@linaria/core';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
-import { AdvancedSettingsToggle } from 'twenty-ui/input';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useIsMobile } from 'twenty-ui/utilities';
-const StyledAdvancedToggleFixedContent = styled.div<{ isMobile: boolean }>`
+const StyledAdvancedSwitchFixedContent = styled.div<{ isMobile: boolean }>`
flex-shrink: 0;
margin-top: auto;
padding-bottom: ${({ isMobile }) =>
@@ -22,7 +22,7 @@ const StyledAdvancedToggleFixedContent = styled.div<{ isMobile: boolean }>`
isMobile ? themeCssVariables.spacing[5] : '0'};
`;
-const advancedSettingsToggleClassName = css`
+const advancedSettingsSwitchClassName = css`
padding-right: 0;
`;
@@ -39,16 +39,16 @@ export const SettingsNavigationDrawerContent = () => {
<SettingsNavigationDrawerItems />
</NavigationDrawerScrollableContent>
- <StyledAdvancedToggleFixedContent isMobile={isMobile}>
+ <StyledAdvancedSwitchFixedContent isMobile={isMobile}>
<NavigationDrawerSection>
- <AdvancedSettingsToggle
- className={advancedSettingsToggleClassName}
+ <AdvancedSettingsSwitch
+ className={advancedSettingsSwitchClassName}
isAdvancedModeEnabled={isAdvancedModeEnabled}
setIsAdvancedModeEnabled={setIsAdvancedModeEnabled}
label={t`Advanced`}
/>
</NavigationDrawerSection>
- </StyledAdvancedToggleFixedContent>
+ </StyledAdvancedSwitchFixedContent>
</>
);
};
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx
index 38b08f61447..19f2b5d35a7 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownLayoutContent.tsx
@@ -36,7 +36,7 @@ import {
IconTable,
} from 'twenty-ui/icon';
import { OverflowingTextWithTooltip } from 'twenty-ui/surfaces';
-import { MenuItem, MenuItemSelect, MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItem, MenuItemSelect, MenuItemSwitch } from 'twenty-ui/navigation';
import { ViewCalendarLayout } from '~/generated-metadata/graphql';
export const ObjectOptionsDropdownLayoutContent = () => {
@@ -308,18 +308,18 @@ export const ObjectOptionsDropdownLayoutContent = () => {
);
}}
>
- <MenuItemToggle
+ <MenuItemSwitch
focused={selectedItemId === 'Compact view'}
LeftIcon={IconBaselineDensitySmall}
- onToggleChange={() =>
+ onCheckedChange={() =>
setAndPersistIsCompactModeActive(
!isCompactModeActive,
currentView,
)
}
- toggled={isCompactModeActive}
+ checked={isCompactModeActive}
text={t`Compact view`}
- toggleSize="small"
+ size="sm"
/>
</SelectableListItem>
)}
diff --git a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx
index 38acbadec0f..68a0452c626 100644
--- a/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx
+++ b/packages/twenty-front/src/modules/object-record/object-options-dropdown/components/ObjectOptionsDropdownRecordGroupsContent.tsx
@@ -38,7 +38,7 @@ import {
import {
MenuItem,
MenuItemNavigate,
- MenuItemToggle,
+ MenuItemSwitch,
} from 'twenty-ui/navigation';
export const ObjectOptionsDropdownRecordGroupsContent = () => {
@@ -177,13 +177,13 @@ export const ObjectOptionsDropdownRecordGroupsContent = () => {
itemId="HideEmptyGroups"
onEnter={() => handleHideEmptyRecordGroupChange()}
>
- <MenuItemToggle
+ <MenuItemSwitch
focused={selectedItemId === 'HideEmptyGroups'}
LeftIcon={IconCircleOff}
- onToggleChange={handleHideEmptyRecordGroupChange}
- toggled={shouldHideEmptyGroups}
+ onCheckedChange={handleHideEmptyRecordGroupChange}
+ checked={shouldHideEmptyGroups}
text={t`Hide empty groups`}
- toggleSize="small"
+ size="sm"
/>
</SelectableListItem>
</SelectableList>
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldToggleInput.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldSwitchInput.tsx
similarity index 77%
rename from packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldToggleInput.tsx
rename to packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldSwitchInput.tsx
index 935e9a47baa..4a8f11428cd 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldToggleInput.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/FormBooleanFieldSwitchInput.tsx
@@ -1,12 +1,12 @@
import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputContainer';
import { FormFieldInputInnerContainer } from '@/object-record/record-field/ui/form-types/components/FormFieldInputInnerContainer';
import { FormFieldInputRowContainer } from '@/object-record/record-field/ui/form-types/components/FormFieldInputRowContainer';
-import { Field, Toggle } from 'twenty-ui/input';
+import { Field, Switch } from 'twenty-ui/input';
import { styled } from '@linaria/react';
import { useId } from 'react';
import { themeCssVariables } from 'twenty-ui/theme-constants';
-type FormBooleanFieldToggleInputProps = {
+type FormBooleanFieldSwitchInputProps = {
label?: string;
description: string;
hint?: string;
@@ -26,7 +26,7 @@ const StyledDescription = styled.span`
white-space: nowrap;
`;
-const StyledToggleContainer = styled.div`
+const StyledSwitchContainer = styled.div`
background-color: ${themeCssVariables.background.transparent.lighter};
border-bottom: 1px solid ${themeCssVariables.border.color.medium};
border-bottom-right-radius: ${themeCssVariables.border.radius.md};
@@ -39,15 +39,16 @@ const StyledToggleContainer = styled.div`
padding-top: ${themeCssVariables.spacing[2]};
`;
-export const FormBooleanFieldToggleInput = ({
+export const FormBooleanFieldSwitchInput = ({
label,
description,
hint,
value,
onChange,
disabled,
-}: FormBooleanFieldToggleInputProps) => {
+}: FormBooleanFieldSwitchInputProps) => {
const instanceId = useId();
+ const descriptionId = `${instanceId}-description`;
return (
<FormFieldInputContainer>
@@ -59,17 +60,20 @@ export const FormBooleanFieldToggleInput = ({
hasRightElement
preventFocusStackUpdate
>
- <StyledDescription>{description}</StyledDescription>
+ <StyledDescription id={descriptionId}>
+ {description}
+ </StyledDescription>
</FormFieldInputInnerContainer>
- <StyledToggleContainer>
- <Toggle
- value={value}
- onChange={onChange}
+ <StyledSwitchContainer>
+ <Switch
+ aria-labelledby={descriptionId}
+ checked={value}
+ onCheckedChange={(checked) => onChange(checked)}
disabled={disabled}
- toggleSize="small"
+ size="sm"
/>
- </StyledToggleContainer>
+ </StyledSwitchContainer>
</FormFieldInputRowContainer>
{hint && <Field.Description>{hint}</Field.Description>}
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormBooleanFieldToggleInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormBooleanFieldSwitchInput.stories.tsx
similarity index 65%
rename from packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormBooleanFieldToggleInput.stories.tsx
rename to packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormBooleanFieldSwitchInput.stories.tsx
index 7dc5a6bb5b6..bcd27674c7c 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormBooleanFieldToggleInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/form-types/components/__stories__/FormBooleanFieldSwitchInput.stories.tsx
@@ -1,10 +1,10 @@
-import { FormBooleanFieldToggleInput } from '@/object-record/record-field/ui/form-types/components/FormBooleanFieldToggleInput';
+import { FormBooleanFieldSwitchInput } from '@/object-record/record-field/ui/form-types/components/FormBooleanFieldSwitchInput';
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
-const meta: Meta<typeof FormBooleanFieldToggleInput> = {
- title: 'UI/Data/Field/Form/Input/FormBooleanFieldToggleInput',
- component: FormBooleanFieldToggleInput,
+const meta: Meta<typeof FormBooleanFieldSwitchInput> = {
+ title: 'UI/Data/Field/Form/Input/FormBooleanFieldSwitchInput',
+ component: FormBooleanFieldSwitchInput,
args: {
description: 'Continue on iteration failure',
value: false,
@@ -15,7 +15,7 @@ const meta: Meta<typeof FormBooleanFieldToggleInput> = {
export default meta;
-type Story = StoryObj<typeof FormBooleanFieldToggleInput>;
+type Story = StoryObj<typeof FormBooleanFieldSwitchInput>;
export const Default: Story = {
play: async ({ canvasElement }) => {
@@ -23,9 +23,9 @@ export const Default: Story = {
await canvas.findByText('Continue on iteration failure');
- const toggle = canvas.getByRole('switch');
+ const control = canvas.getByRole('switch');
- expect(toggle).not.toBeChecked();
+ expect(control).not.toBeChecked();
},
};
@@ -38,6 +38,9 @@ export const WithLabel: Story = {
await canvas.findByText('Settings');
await canvas.findByText('Continue on iteration failure');
+ expect(
+ canvas.getByRole('switch', { name: 'Continue on iteration failure' }),
+ ).not.toBeChecked();
},
};
@@ -54,20 +57,20 @@ export const WithHint: Story = {
},
};
-export const ToggledOn: Story = {
+export const Checked: Story = {
args: {
value: true,
},
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
- const toggle = canvas.getByRole('switch');
+ const control = canvas.getByRole('switch');
- expect(toggle).toBeChecked();
+ expect(control).toBeChecked();
},
};
-export const TogglesValue: Story = {
+export const ChangesValue: Story = {
args: {
value: false,
onChange: fn(),
@@ -75,9 +78,9 @@ export const TogglesValue: Story = {
play: async ({ canvasElement, args }) => {
const canvas = within(canvasElement);
- const toggle = canvas.getByRole('switch');
+ const control = canvas.getByRole('switch');
- await userEvent.click(toggle);
+ await userEvent.click(control);
await waitFor(() => {
expect(args.onChange).toHaveBeenCalledWith(true);
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelDetails.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelDetails.tsx
index ae3e3ac8120..61fe7fe76f6 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelDetails.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarChannelDetails.tsx
@@ -2,7 +2,7 @@ import { type CalendarChannel } from '@/accounts/types/CalendarChannel';
import { UPDATE_CALENDAR_CHANNEL } from '@/settings/accounts/graphql/mutations/updateCalendarChannel';
import { useMutation } from '@apollo/client/react';
import { SettingsAccountsEventVisibilitySettingsCard } from '@/settings/accounts/components/SettingsAccountsCalendarVisibilitySettingsCard';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { Section } from 'twenty-ui/layout';
@@ -62,7 +62,7 @@ export const SettingsAccountsCalendarChannelDetails = ({
description={t`Automatically create contacts for people you've participated in an event with.`}
/>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconUserPlus}
title={t`Auto-creation`}
description={t`Automatically create contacts for people.`}
diff --git a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelDetails.tsx b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelDetails.tsx
index 5dac60eeafe..4c60b0bb25e 100644
--- a/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelDetails.tsx
+++ b/packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsMessageChannelDetails.tsx
@@ -18,7 +18,7 @@ import { SettingsAccountsMessageAutoCreationCard } from '@/settings/accounts/com
import { SettingsAccountsMessageFolderCard } from '@/settings/accounts/components/SettingsAccountsMessageFolderCard';
import { SettingsAccountsMessageVisibilityCard } from '@/settings/accounts/components/SettingsAccountsMessageVisibilityCard';
import { UPDATE_MESSAGE_CHANNEL } from '@/settings/accounts/graphql/mutations/updateMessageChannel';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { type MessageChannelVisibility } from '~/generated/graphql';
type SettingsAccountsMessageChannelDetailsProps = {
@@ -106,7 +106,7 @@ export const SettingsAccountsMessageChannelDetails = ({
{!isGroupMailbox && (
<Section>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconUsers}
title={t`Exclude group emails`}
description={t`Don't sync emails from team@ support@ noreply@...`}
@@ -142,7 +142,7 @@ export const SettingsAccountsMessageChannelDetails = ({
</Section>
<Section>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconBriefcase}
title={t`Exclude non-professional emails`}
description={t`Don't create contacts from/to Gmail, Outlook emails`}
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx b/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx
index 767e0cf8c34..61c2ebc3691 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/apps/components/SettingsAdminApps.tsx
@@ -32,7 +32,7 @@ import {
import { H2Title } from 'twenty-ui/typography';
import { Button, SearchInput } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
-import { MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSwitch } from 'twenty-ui/navigation';
import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
import { Tag } from 'twenty-ui/data-display';
import {
@@ -218,68 +218,68 @@ export const SettingsAdminApps = () => {
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconPinned}
- onToggleChange={() =>
+ onCheckedChange={() =>
setShowPreInstalledOnly(!showPreInstalledOnly)
}
- toggled={showPreInstalledOnly}
+ checked={showPreInstalledOnly}
text={t`Pre-installed only`}
- toggleSize="small"
+ size="sm"
/>
<DropdownMenuSectionLabel label={t`Source`} />
{SOURCE_TYPE_FILTER_OPTIONS.map(({ sourceType, label }) => (
- <MenuItemToggle
+ <MenuItemSwitch
key={sourceType}
- onToggleChange={() =>
+ onCheckedChange={() =>
toggleSourceTypeFilter(sourceType)
}
- toggled={sourceTypeFilters.includes(sourceType)}
+ checked={sourceTypeFilters.includes(sourceType)}
text={label}
- toggleSize="small"
+ size="sm"
/>
))}
<DropdownMenuSectionLabel label={t`Listed`} />
- <MenuItemToggle
- onToggleChange={() =>
+ <MenuItemSwitch
+ onCheckedChange={() =>
setIsListedFilter(
isListedFilter === true ? undefined : true,
)
}
- toggled={isListedFilter === true}
+ checked={isListedFilter === true}
text={t`Listed`}
- toggleSize="small"
+ size="sm"
/>
- <MenuItemToggle
- onToggleChange={() =>
+ <MenuItemSwitch
+ onCheckedChange={() =>
setIsListedFilter(
isListedFilter === false ? undefined : false,
)
}
- toggled={isListedFilter === false}
+ checked={isListedFilter === false}
text={t`Not listed`}
- toggleSize="small"
+ size="sm"
/>
<DropdownMenuSectionLabel label={t`Configured`} />
- <MenuItemToggle
- onToggleChange={() =>
+ <MenuItemSwitch
+ onCheckedChange={() =>
setIsConfiguredFilter(
isConfiguredFilter === true ? undefined : true,
)
}
- toggled={isConfiguredFilter === true}
+ checked={isConfiguredFilter === true}
text={t`Configured`}
- toggleSize="small"
+ size="sm"
/>
- <MenuItemToggle
- onToggleChange={() =>
+ <MenuItemSwitch
+ onCheckedChange={() =>
setIsConfiguredFilter(
isConfiguredFilter === false ? undefined : false,
)
}
- toggled={isConfiguredFilter === false}
+ checked={isConfiguredFilter === false}
text={t`Not configured`}
- toggleSize="small"
+ size="sm"
/>
</DropdownMenuItemsContainer>
</DropdownContent>
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/chats/components/SettingsAdminChatsFilterDropdown.tsx b/packages/twenty-front/src/modules/settings/admin-panel/chats/components/SettingsAdminChatsFilterDropdown.tsx
index af485d9e09f..d0d630de4cc 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/chats/components/SettingsAdminChatsFilterDropdown.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/chats/components/SettingsAdminChatsFilterDropdown.tsx
@@ -2,7 +2,7 @@ import { t } from '@lingui/core/macro';
import { type ReactNode } from 'react';
import { IconAlertTriangle, IconMessage, IconSparkles } from 'twenty-ui/icon';
-import { MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSwitch } from 'twenty-ui/navigation';
import { type AdminChatsFilterState } from '@/settings/admin-panel/chats/types/AdminChatsFilterState';
import { Dropdown } from '@/ui/layout/dropdown/components/Dropdown';
@@ -29,41 +29,41 @@ export const SettingsAdminChatsFilterDropdown = ({
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconSparkles}
- onToggleChange={() =>
+ onCheckedChange={() =>
onFiltersChange({
...filters,
onboardingOnly: !filters.onboardingOnly,
})
}
- toggled={filters.onboardingOnly}
+ checked={filters.onboardingOnly}
text={t`Onboarding only`}
- toggleSize="small"
+ size="sm"
/>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconAlertTriangle}
- onToggleChange={() =>
+ onCheckedChange={() =>
onFiltersChange({
...filters,
hasErrorOnly: !filters.hasErrorOnly,
})
}
- toggled={filters.hasErrorOnly}
+ checked={filters.hasErrorOnly}
text={t`Has error`}
- toggleSize="small"
+ size="sm"
/>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconMessage}
- onToggleChange={() =>
+ onCheckedChange={() =>
onFiltersChange({
...filters,
userNeverEngagedOnly: !filters.userNeverEngagedOnly,
})
}
- toggled={filters.userNeverEngagedOnly}
+ checked={filters.userNeverEngagedOnly}
text={t`No user reply`}
- toggleSize="small"
+ size="sm"
/>
</DropdownMenuItemsContainer>
</DropdownContent>
diff --git a/packages/twenty-front/src/modules/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceMode.tsx b/packages/twenty-front/src/modules/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceMode.tsx
index 3d8297025a4..f2f48dd4e39 100644
--- a/packages/twenty-front/src/modules/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceMode.tsx
+++ b/packages/twenty-front/src/modules/settings/admin-panel/health-status/maintenance-mode/components/SettingsAdminMaintenanceMode.tsx
@@ -17,7 +17,7 @@ import { CLEAR_MAINTENANCE_MODE } from '@/settings/admin-panel/health-status/mai
import { SET_MAINTENANCE_MODE } from '@/settings/admin-panel/health-status/maintenance-mode/graphql/mutations/setMaintenanceMode';
import { adminPanelMaintenanceModeState } from '@/settings/admin-panel/health-status/maintenance-mode/states/adminPanelMaintenanceModeState';
import { SettingsDatePickerInput } from '@/settings/components/SettingsDatePickerInput';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { InputHint } from 'twenty-ui/input';
import { TextInput } from '@/ui/input/components/TextInput';
@@ -197,7 +197,7 @@ export const SettingsAdminMaintenanceMode = () => {
description={t`Schedule a maintenance window and notify all users`}
/>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconTool}
title={t`Maintenance mode`}
description={toggleDescription}
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSwitch.tsx
similarity index 62%
rename from packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx
rename to packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSwitch.tsx
index 84b5992db5e..f5d188593cc 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentToggle.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/SettingsOptionCardContentSwitch.tsx
@@ -7,13 +7,23 @@ import {
} from '@/settings/components/SettingsOptions/SettingsCardContentBase';
import { SettingsOptionIconCustomizer } from '@/settings/components/SettingsOptions/SettingsOptionIconCustomizer';
import { styled } from '@linaria/react';
-import { useContext, useId } from 'react';
+import { useId } from 'react';
import { type IconComponent } from 'twenty-ui/icon';
import { OverflowingTextWithTooltip } from 'twenty-ui/surfaces';
-import { Toggle } from 'twenty-ui/input';
-import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
+import { Switch } from 'twenty-ui/input';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
-const StyledSettingsCardToggleContent = styled.div<{ disabled?: boolean }>`
+const StyledSwitch = styled(Switch)`
+ &[data-centered] {
+ align-self: center;
+ }
+
+ &[data-advanced-mode] {
+ color: ${themeCssVariables.color.yellow};
+ }
+`;
+
+const StyledSettingsCardSwitchContent = styled.div<{ disabled?: boolean }>`
align-items: center;
background-color: ${themeCssVariables.background.secondary};
cursor: ${({ disabled }) => (disabled ? 'default' : 'pointer')};
@@ -28,48 +38,47 @@ const StyledSettingsCardToggleContent = styled.div<{ disabled?: boolean }>`
}
`;
-const StyledSettingsCardToggleButtonContainer = styled.span`
+const StyledSettingsCardSwitchButtonContainer = styled.span`
align-items: center;
display: flex;
flex-shrink: 0;
margin-left: auto;
`;
-const StyledSettingsCardToggleCover = styled.span`
+const StyledSettingsCardSwitchCover = styled.span`
cursor: pointer;
inset: 0;
position: absolute;
`;
-type SettingsOptionCardContentToggleProps = {
+type SettingsOptionCardContentSwitchProps = {
Icon?: IconComponent;
title: React.ReactNode;
description?: string;
divider?: boolean;
disabled?: boolean;
advancedMode?: boolean;
- toggleCentered?: boolean;
+ switchCentered?: boolean;
checked: boolean;
onChange: (checked: boolean) => void;
};
-export const SettingsOptionCardContentToggle = ({
+export const SettingsOptionCardContentSwitch = ({
Icon,
title,
description,
divider,
disabled = false,
advancedMode = false,
- toggleCentered = true,
+ switchCentered = true,
checked,
onChange,
-}: SettingsOptionCardContentToggleProps) => {
- const { theme } = useContext(ThemeContext);
- const toggleId = useId();
+}: SettingsOptionCardContentSwitchProps) => {
+ const switchId = useId();
return (
<>
- <StyledSettingsCardToggleContent disabled={disabled}>
+ <StyledSettingsCardSwitchContent disabled={disabled}>
{Icon && (
<StyledSettingsCardIcon>
<SettingsOptionIconCustomizer Icon={Icon} />
@@ -77,9 +86,9 @@ export const SettingsOptionCardContentToggle = ({
)}
<StyledSettingsCardTextContainer>
<StyledSettingsCardTitle>
- <label htmlFor={toggleId}>
+ <label htmlFor={switchId}>
{title}
- <StyledSettingsCardToggleCover />
+ <StyledSettingsCardSwitchCover />
</label>
</StyledSettingsCardTitle>
{description && (
@@ -88,18 +97,18 @@ export const SettingsOptionCardContentToggle = ({
</StyledSettingsCardDescription>
)}
</StyledSettingsCardTextContainer>
- <StyledSettingsCardToggleButtonContainer>
- <Toggle
- id={toggleId}
- value={checked}
- onChange={onChange}
+ <StyledSettingsCardSwitchButtonContainer>
+ <StyledSwitch
+ id={switchId}
+ checked={checked}
+ onCheckedChange={onChange}
disabled={disabled}
- toggleSize="small"
- color={advancedMode ? theme.color.yellow : theme.color.blue}
- centered={toggleCentered}
+ size="sm"
+ data-advanced-mode={advancedMode || undefined}
+ data-centered={switchCentered || undefined}
/>
- </StyledSettingsCardToggleButtonContainer>
- </StyledSettingsCardToggleContent>
+ </StyledSettingsCardSwitchButtonContainer>
+ </StyledSettingsCardSwitchContent>
{divider && <Separator />}
</>
);
diff --git a/packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentToggle.stories.tsx b/packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentSwitch.stories.tsx
similarity index 73%
rename from packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentToggle.stories.tsx
rename to packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentSwitch.stories.tsx
index f480f13453c..7fe08869c3c 100644
--- a/packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentToggle.stories.tsx
+++ b/packages/twenty-front/src/modules/settings/components/SettingsOptions/__stories__/SettingsOptionCardContentSwitch.stories.tsx
@@ -1,4 +1,4 @@
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { styled } from '@linaria/react';
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { useState } from 'react';
@@ -9,14 +9,14 @@ const StyledContainer = styled.div`
width: 480px;
`;
-const SettingsOptionCardContentToggleWrapper = (
- args: React.ComponentProps<typeof SettingsOptionCardContentToggle>,
+const SettingsOptionCardContentSwitchWrapper = (
+ args: React.ComponentProps<typeof SettingsOptionCardContentSwitch>,
) => {
const [checked, setChecked] = useState(args.checked);
return (
<StyledContainer>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
checked={checked}
onChange={setChecked}
Icon={args.Icon}
@@ -30,9 +30,9 @@ const SettingsOptionCardContentToggleWrapper = (
);
};
-const meta: Meta<typeof SettingsOptionCardContentToggleWrapper> = {
- title: 'Modules/Settings/SettingsOptionCardContentToggle',
- component: SettingsOptionCardContentToggleWrapper,
+const meta: Meta<typeof SettingsOptionCardContentSwitchWrapper> = {
+ title: 'Modules/Settings/SettingsOptionCardContentSwitch',
+ component: SettingsOptionCardContentSwitchWrapper,
decorators: [ComponentDecorator],
parameters: {
maxWidth: 800,
@@ -40,7 +40,7 @@ const meta: Meta<typeof SettingsOptionCardContentToggleWrapper> = {
};
export default meta;
-type Story = StoryObj<typeof SettingsOptionCardContentToggleWrapper>;
+type Story = StoryObj<typeof SettingsOptionCardContentSwitchWrapper>;
export const Default: Story = {
args: {
@@ -77,8 +77,8 @@ export const AdvancedMode: Story = {
export const WithoutIcon: Story = {
args: {
- title: 'Simple Toggle',
- description: 'A basic toggle without an icon',
+ title: 'Simple Switch',
+ description: 'A basic switch without an icon',
checked: true,
},
};
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx
index f730a0a75ff..ce5198d6d41 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIconLabelForm.tsx
@@ -8,7 +8,7 @@ import { type FieldMetadataItem } from '@/object-metadata/types/FieldMetadataIte
import { fieldMetadataItemSchema } from '@/object-metadata/validation-schemas/fieldMetadataItemSchema';
import { AdvancedSettingsContentWrapperWithDot } from '@/settings/components/AdvancedSettingsContentWrapperWithDot';
import { AdvancedSettingsWrapper } from '@/settings/components/AdvancedSettingsWrapper';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { IDENTIFIER_MAX_CHAR_LENGTH } from 'twenty-shared/metadata';
import { getErrorMessageFromError } from '@/settings/data-model/fields/forms/utils/errorMessages';
import { IconPicker } from '@/ui/input/components/IconPicker';
@@ -241,7 +241,7 @@ export const SettingsDataModelFieldIconLabelForm = ({
dotPosition="centered"
>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconRefresh}
title={t`Synchronize Field Label and API Name`}
description={t`Should changing a field's label also change the API name?`}
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIsUniqueForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIsUniqueForm.tsx
index e7e51161716..7099ab5ac1c 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIsUniqueForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/components/SettingsDataModelFieldIsUniqueForm.tsx
@@ -7,7 +7,7 @@ import { canBeUnique } from '@/settings/data-model/fields/forms/utils/canBeUniqu
import { t } from '@lingui/core/macro';
import { type FieldMetadataType } from 'twenty-shared/types';
import { IconKey } from 'twenty-ui/icon';
-import { Toggle } from 'twenty-ui/input';
+import { Switch } from 'twenty-ui/input';
type SettingsDataModelFieldIsUniqueFormValues = {
isUnique: boolean;
@@ -65,10 +65,11 @@ export const SettingsDataModelFieldIsUniqueForm = ({
title={t`Unique`}
description={t`Prevent from assigning the same value to different records`}
>
- <Toggle
- toggleSize="small"
- value={isUnique}
- onChange={(value) => onChange(value)}
+ <Switch
+ aria-label={t`Unique`}
+ size="sm"
+ checked={isUnique}
+ onCheckedChange={(value) => onChange(value)}
disabled={disabled || hasStandardUniqueIndex}
/>
</SettingsOptionCardContentSelect>
diff --git a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx
index bd520b1c3d7..013ff0c536c 100644
--- a/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/fields/forms/morph-relation/components/SettingsDataModelFieldRelationJunctionForm.tsx
@@ -10,7 +10,7 @@ import { useFieldMetadataItemById } from '@/object-metadata/hooks/useFieldMetada
import { findFieldMetadataItemByFieldMetadataId } from '@/object-metadata/utils/findFieldMetadataItemByFieldMetadataId';
import { isValidJunctionTargetField } from '@/object-record/record-field/ui/utils/junction/isValidJunctionTargetField';
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { Select } from '@/ui/input/components/Select';
import { isAdvancedModeEnabledState } from '@/ui/navigation/navigation-drawer/states/isAdvancedModeEnabledState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
@@ -157,7 +157,7 @@ export const SettingsDataModelFieldRelationJunctionForm = ({
return (
<>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconLink}
title={t`This is a relation to a Junction Object`}
description={t`Build many-to-many relations`}
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx
index f85e8a0acd5..1257679eb6d 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsObjectRelationsTable.tsx
@@ -23,7 +23,7 @@ import { useMemo, useState } from 'react';
import { FieldMetadataType } from 'twenty-shared/types';
import { IconArchive, IconFilter, IconSearch } from 'twenty-ui/icon';
import { Button } from 'twenty-ui/input';
-import { MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSwitch } from 'twenty-ui/navigation';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { isDefined } from 'twenty-shared/utils';
import { normalizeSearchText } from '~/utils/normalizeSearchText';
@@ -217,12 +217,12 @@ export const SettingsObjectRelationsTable = ({
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconArchive}
- onToggleChange={() => setShowInactive(!showInactive)}
- toggled={showInactive}
+ onCheckedChange={() => setShowInactive(!showInactive)}
+ checked={showInactive}
text={t`Inactive`}
- toggleSize="small"
+ size="sm"
/>
</DropdownMenuItemsContainer>
</DropdownContent>
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx
index b431c820e51..b1b5ec6a714 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectIndexesSection.tsx
@@ -19,7 +19,7 @@ import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath, isDefined } from 'twenty-shared/utils';
import { IconEyeOff, IconPlus } from 'twenty-ui/icon';
import { Button, SearchInput } from 'twenty-ui/input';
-import { MenuItemToggle, UndecoratedLink } from 'twenty-ui/navigation';
+import { MenuItemSwitch, UndecoratedLink } from 'twenty-ui/navigation';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { SettingsObjectIndexTable } from '~/pages/settings/data-model/SettingsObjectIndexTable';
import { type SettingsObjectIndexesTableItem } from '~/pages/settings/data-model/types/SettingsObjectIndexesTableItem';
@@ -173,14 +173,14 @@ export const SettingsObjectIndexesSection = ({
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconEyeOff}
- onToggleChange={() =>
+ onCheckedChange={() =>
setHideSystemIndexes(!hideSystemIndexes)
}
- toggled={hideSystemIndexes}
+ checked={hideSystemIndexes}
text={t`Hide system indexes`}
- toggleSize="small"
+ size="sm"
/>
</DropdownMenuItemsContainer>
</DropdownContent>
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection.tsx
index ac9d1b7c27a..d90ad9ac21b 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/tabs/SettingsObjectSearchSection.tsx
@@ -2,7 +2,7 @@ import { useUpdateOneFieldMetadataItem } from '@/object-metadata/hooks/useUpdate
import { useUpdateOneObjectMetadataItem } from '@/object-metadata/hooks/useUpdateOneObjectMetadataItem';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
import { SEARCH_VECTOR_FIELD_NAME } from '@/object-record/constants/SearchVectorFieldName';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { SettingsObjectFieldDataType } from '@/settings/data-model/object-details/components/SettingsObjectFieldDataType';
import { canBeSearchable } from '@/settings/data-model/fields/forms/utils/canBeSearchable';
import { type SettingsFieldType } from '@/settings/data-model/types/SettingsFieldType';
@@ -185,7 +185,7 @@ export const SettingsObjectSearchSection = ({
<StyledSearchSectionContent>
{!isReadOnly && (
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconEye}
title={t`Global search`}
description={t`Show this object's records in the command menu (⌘K).`}
diff --git a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
index 830a2bbebf6..e7ac6d34d4f 100644
--- a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
@@ -1,7 +1,7 @@
import { useGetIsMetadataItemCustom } from '@/object-metadata/hooks/useGetIsMetadataItemCustom';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
import { AdvancedSettingsWrapper } from '@/settings/components/AdvancedSettingsWrapper';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { OBJECT_NAME_MAXIMUM_LENGTH } from '@/settings/data-model/constants/ObjectNameMaximumLength';
import { type SettingsDataModelObjectAboutFormValues } from '@/settings/data-model/validation-schemas/settingsDataModelObjectAboutFormSchema';
import { IconPicker } from '@/ui/input/components/IconPicker';
@@ -364,7 +364,7 @@ export const SettingsDataModelObjectAboutForm = ({
defaultValue={objectMetadataItem?.isLabelSyncedWithName}
render={({ field: { onChange, value } }) => (
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconRefresh}
title={t`Synchronize Objects Labels and API Names`}
description={t`Should changing an object's label also change the API?`}
@@ -400,7 +400,7 @@ export const SettingsDataModelObjectAboutForm = ({
defaultValue={false}
render={({ field: { onChange, value } }) => (
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconLink}
title={t`Skip creating a Name field `}
description={t`Useful for pivot/junction tables`}
diff --git a/packages/twenty-front/src/modules/settings/lab/components/SettingsLabContent.tsx b/packages/twenty-front/src/modules/settings/lab/components/SettingsLabContent.tsx
index 517fc5367ed..8bb1518b4fb 100644
--- a/packages/twenty-front/src/modules/settings/lab/components/SettingsLabContent.tsx
+++ b/packages/twenty-front/src/modules/settings/lab/components/SettingsLabContent.tsx
@@ -1,5 +1,5 @@
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { useLabPublicFeatureFlags } from '@/settings/lab/hooks/useLabPublicFeatureFlags';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { styled } from '@linaria/react';
@@ -64,13 +64,13 @@ export const SettingsLabContent = () => {
onError={() => handleImageError(flag.key)}
/>
)}
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={getIcon(flag.metadata.icon)}
title={flag.metadata.label}
description={flag.metadata.description}
checked={flag.value}
onChange={(value) => handleToggle(flag.key, value)}
- toggleCentered={false}
+ switchCentered={false}
/>
</Card>
))}
@@ -81,14 +81,14 @@ export const SettingsLabContent = () => {
backgroundColor={themeCssVariables.background.secondary}
>
{labPublicFeatureFlagsWithoutImage.map((flag, index) => (
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
key={flag.key}
Icon={getIcon(flag.metadata.icon)}
title={flag.metadata.label}
description={flag.metadata.description}
checked={flag.value}
onChange={(value) => handleToggle(flag.key, value)}
- toggleCentered={false}
+ switchCentered={false}
divider={index < labPublicFeatureFlagsWithoutImage.length - 1}
/>
))}
diff --git a/packages/twenty-front/src/modules/settings/logic-functions/components/triggers/SettingsLogicFunctionHttpTriggerSection.tsx b/packages/twenty-front/src/modules/settings/logic-functions/components/triggers/SettingsLogicFunctionHttpTriggerSection.tsx
index 2e558cc3cc9..f3944bbe8eb 100644
--- a/packages/twenty-front/src/modules/settings/logic-functions/components/triggers/SettingsLogicFunctionHttpTriggerSection.tsx
+++ b/packages/twenty-front/src/modules/settings/logic-functions/components/triggers/SettingsLogicFunctionHttpTriggerSection.tsx
@@ -6,7 +6,6 @@ import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
-import { useContext } from 'react';
import { type HttpRouteTriggerSettings } from 'twenty-shared/application';
import { HTTPMethod } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
@@ -19,8 +18,8 @@ import {
IconHttpPut,
type IconComponent,
} from 'twenty-ui/icon';
-import { Toggle } from 'twenty-ui/input';
-import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
+import { Switch } from 'twenty-ui/input';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useGetLogicFunctionHttpUrl } from '@/settings/logic-functions/hooks/useGetLogicFunctionHttpUrl';
import { useCopyToClipboard } from '~/hooks/useCopyToClipboard';
@@ -71,7 +70,6 @@ export const SettingsLogicFunctionHttpTriggerSection = ({
readonly,
}: SettingsLogicFunctionHttpTriggerSectionProps) => {
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
const { copyToClipboard } = useCopyToClipboard();
const { getLogicFunctionHttpUrl } = useGetLogicFunctionHttpUrl();
@@ -132,12 +130,14 @@ export const SettingsLogicFunctionHttpTriggerSection = ({
}
/>
<StyledAuthRow>
- <Toggle
- value={value.isAuthRequired}
- onChange={(checked) => updateField('isAuthRequired', checked)}
+ <Switch
+ aria-label={t`Require authentication`}
+ checked={value.isAuthRequired}
+ onCheckedChange={(checked) =>
+ updateField('isAuthRequired', checked)
+ }
disabled={readonly}
- toggleSize="small"
- color={theme.color.blue}
+ size="sm"
/>
<StyledAuthLabel>{t`Require authentication`}</StyledAuthLabel>
</StyledAuthRow>
diff --git a/packages/twenty-front/src/modules/settings/logic-functions/components/triggers/SettingsLogicFunctionTriggerSection.tsx b/packages/twenty-front/src/modules/settings/logic-functions/components/triggers/SettingsLogicFunctionTriggerSection.tsx
index f1878f678ae..5cea618b5ba 100644
--- a/packages/twenty-front/src/modules/settings/logic-functions/components/triggers/SettingsLogicFunctionTriggerSection.tsx
+++ b/packages/twenty-front/src/modules/settings/logic-functions/components/triggers/SettingsLogicFunctionTriggerSection.tsx
@@ -1,9 +1,9 @@
import { styled } from '@linaria/react';
-import { useContext, type ReactNode } from 'react';
+import { type ReactNode } from 'react';
import { H2Title } from 'twenty-ui/typography';
-import { Toggle } from 'twenty-ui/input';
+import { Switch } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
-import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
const StyledHeader = styled.div`
align-items: center;
@@ -33,8 +33,6 @@ export const SettingsLogicFunctionTriggerSection = ({
readonly,
children,
}: SettingsLogicFunctionTriggerSectionProps) => {
- const { theme } = useContext(ThemeContext);
-
if (readonly && !enabled) {
return null;
}
@@ -44,11 +42,11 @@ export const SettingsLogicFunctionTriggerSection = ({
<StyledHeader>
<H2Title title={title} description={description} />
{!readonly && (
- <Toggle
- value={enabled}
- onChange={onEnabledChange}
- toggleSize="small"
- color={theme.color.blue}
+ <Switch
+ aria-label={title}
+ checked={enabled}
+ onCheckedChange={onEnabledChange}
+ size="sm"
/>
)}
</StyledHeader>
diff --git a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx
index fddd6e57ace..aa770a5d72b 100644
--- a/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/components/SettingsRolesList.tsx
@@ -22,7 +22,7 @@ import {
import { H2Title } from 'twenty-ui/typography';
import { Button } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
-import { MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSwitch } from 'twenty-ui/navigation';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { sortByAscString } from '~/utils/array/sortByAscString';
@@ -111,19 +111,19 @@ export const SettingsRolesList = () => {
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconLego}
- onToggleChange={() => setShowAgentRoles(!showAgentRoles)}
- toggled={showAgentRoles}
+ onCheckedChange={() => setShowAgentRoles(!showAgentRoles)}
+ checked={showAgentRoles}
text={t`Agent roles`}
- toggleSize="small"
+ size="sm"
/>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconKey}
- onToggleChange={() => setShowApiKeyRoles(!showApiKeyRoles)}
- toggled={showApiKeyRoles}
+ onCheckedChange={() => setShowApiKeyRoles(!showApiKeyRoles)}
+ checked={showApiKeyRoles}
text={t`API key roles`}
- toggleSize="small"
+ size="sm"
/>
</DropdownMenuItemsContainer>
</DropdownContent>
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx
index e1bf2ead6dd..8ef81bec775 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsSection.tsx
@@ -1,4 +1,4 @@
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { SettingsRolePermissionsSettingsTableHeader } from '@/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader';
import { SettingsRolePermissionsSettingsTableRow } from '@/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow';
import { useSettingsRolePermissionFlagConfig } from '@/settings/roles/role-permissions/permission-flags/hooks/useSettingsRolePermissionFlagConfig';
@@ -62,7 +62,7 @@ export const SettingsRolePermissionsSettingsSection = ({
{shouldShowAllAccessToggle && (
<StyledCardContainer>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconSettings}
title={t`Settings All Access`}
description={t`Ability to edit all settings`}
diff --git a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx
index c9adbae90a0..e3933555a5f 100644
--- a/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx
+++ b/packages/twenty-front/src/modules/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsToolSection.tsx
@@ -1,4 +1,4 @@
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { SettingsRolePermissionsSettingsTableHeader } from '@/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableHeader';
import { SettingsRolePermissionsSettingsTableRow } from '@/settings/roles/role-permissions/permission-flags/components/SettingsRolePermissionsSettingsTableRow';
import { useActionRolePermissionFlagConfig } from '@/settings/roles/role-permissions/permission-flags/hooks/useActionRolePermissionFlagConfig';
@@ -63,7 +63,7 @@ export const SettingsRolePermissionsToolSection = ({
{shouldShowAllAccessToggle && (
<StyledCardContainer>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconTool}
title={t`All Actions Access`}
description={t`Grants permission to perform all available actions without restriction`}
diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthBypassOptionsList.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthBypassOptionsList.tsx
index 34f2421a72c..fdd40295336 100644
--- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthBypassOptionsList.tsx
+++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthBypassOptionsList.tsx
@@ -1,6 +1,6 @@
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { authProvidersState } from '@/client-config/states/authProvidersState';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { CombinedGraphQLErrors } from '@apollo/client/errors';
import { styled } from '@linaria/react';
@@ -85,7 +85,7 @@ export const SettingsSecurityAuthBypassOptionsList = () => {
<StyledSettingsSecurityOptionsList>
<Card rounded>
{authProviders.google === true && (
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconGoogle}
title={t`Google`}
description={t`Allow Google-based login for users with SSO bypass permissions.`}
@@ -96,7 +96,7 @@ export const SettingsSecurityAuthBypassOptionsList = () => {
/>
)}
{authProviders.microsoft === true && (
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconMicrosoft}
title={t`Microsoft`}
description={t`Allow Microsoft-based login for users with SSO bypass permissions.`}
@@ -107,7 +107,7 @@ export const SettingsSecurityAuthBypassOptionsList = () => {
/>
)}
{authProviders.password && (
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconPassword}
title={t`Password`}
description={t`Allow email & password login for SSO bypass users.`}
diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx
index b86c68eaed5..bc54d818615 100644
--- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx
+++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecurityAuthProvidersOptionsList.tsx
@@ -3,7 +3,7 @@ import { authProvidersState } from '@/client-config/states/authProvidersState';
import { isMultiWorkspaceEnabledState } from '@/client-config/states/isMultiWorkspaceEnabledState';
import { useReadDefaultDomainFromConfiguration } from '@/domain-manager/hooks/useReadDefaultDomainFromConfiguration';
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { ssoIdentitiesProvidersState } from '@/settings/security/states/ssoIdentitiesProvidersState';
import { Select } from '@/ui/input/components/Select';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
@@ -29,7 +29,7 @@ import {
WorkspaceDiscoverability,
} from '~/generated-metadata/graphql';
-import { Toggle2FA } from './Toggle2FA';
+import { TwoFactorAuthenticationSwitch } from './TwoFactorAuthenticationSwitch';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
const StyledSettingsSecurityOptionsList = styled.div`
@@ -204,7 +204,7 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {
<>
<Card rounded>
{authProviders.google === true && (
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconGoogle}
title={t`Google`}
description={t`Allow logins through Google's single sign-on functionality.`}
@@ -217,7 +217,7 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {
/>
)}
{authProviders.microsoft === true && (
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconMicrosoft}
title={t`Microsoft`}
description={t`Allow logins through Microsoft's single sign-on functionality.`}
@@ -230,7 +230,7 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {
/>
)}
{authProviders.password === true && (
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconPassword}
title={t`Password`}
description={t`Allow users to sign in with an email and password.`}
@@ -241,7 +241,7 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {
)}
</Card>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconLink}
title={t`Invite by Link`}
description={t`Allow the invitation of new users by sharing an invite link.`}
@@ -272,7 +272,7 @@ export const SettingsSecurityAuthProvidersOptionsList = () => {
/>
</SettingsOptionCardContentSelect>
)}
- <Toggle2FA />
+ <TwoFactorAuthenticationSwitch />
</Card>
</>
)}
diff --git a/packages/twenty-front/src/modules/settings/security/components/SettingsSecuritySettings.tsx b/packages/twenty-front/src/modules/settings/security/components/SettingsSecuritySettings.tsx
index da03f73b350..304d00a4cc6 100644
--- a/packages/twenty-front/src/modules/settings/security/components/SettingsSecuritySettings.tsx
+++ b/packages/twenty-front/src/modules/settings/security/components/SettingsSecuritySettings.tsx
@@ -10,7 +10,7 @@ import { Separator } from '@/settings/components/Separator';
import { SettingsEnterpriseFeatureGateCard } from '@/settings/components/SettingsEnterpriseFeatureGateCard';
import { SettingsOptionCardContentButton } from '@/settings/components/SettingsOptions/SettingsOptionCardContentButton';
import { SettingsOptionCardContentCounter } from '@/settings/components/SettingsOptions/SettingsOptionCardContentCounter';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { SettingsRoleDefaultRole } from '@/settings/roles/components/SettingsRolesDefaultRole';
import { SettingsRolesQueryEffect } from '@/settings/roles/components/SettingsRolesQueryEffect';
import { useSettingsAllRoles } from '@/settings/roles/hooks/useSettingsAllRoles';
@@ -19,7 +19,7 @@ import { SettingsSecurityAuthBypassOptionsList } from '@/settings/security/compo
import { SettingsSecurityAuthProvidersOptionsList } from '@/settings/security/components/SettingsSecurityAuthProvidersOptionsList';
import { SettingsSecurityEditableProfileFields } from '@/settings/security/components/SettingsSecurityEditableProfileFields';
import { ssoIdentitiesProvidersState } from '@/settings/security/states/ssoIdentitiesProvidersState';
-import { ToggleImpersonate } from '@/settings/workspace/components/ToggleImpersonate';
+import { ImpersonationSwitch } from '@/settings/workspace/components/ImpersonationSwitch';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
@@ -232,7 +232,7 @@ export const SettingsSecuritySettings = () => {
title={t`Support`}
description={t`Manage support access settings`}
/>
- <ToggleImpersonate />
+ <ImpersonationSwitch />
</Section>
)}
<Section>
@@ -283,7 +283,7 @@ export const SettingsSecuritySettings = () => {
showButtons={false}
/>
<Separator />
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconMail}
title={t`Sync Internal Emails`}
description={t`Include emails where all participants share the same domain.`}
diff --git a/packages/twenty-front/src/modules/settings/security/components/Toggle2FA.tsx b/packages/twenty-front/src/modules/settings/security/components/TwoFactorAuthenticationSwitch.tsx
similarity index 89%
rename from packages/twenty-front/src/modules/settings/security/components/Toggle2FA.tsx
rename to packages/twenty-front/src/modules/settings/security/components/TwoFactorAuthenticationSwitch.tsx
index 532d1940a08..df2eadd40b8 100644
--- a/packages/twenty-front/src/modules/settings/security/components/Toggle2FA.tsx
+++ b/packages/twenty-front/src/modules/settings/security/components/TwoFactorAuthenticationSwitch.tsx
@@ -1,6 +1,6 @@
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { CombinedGraphQLErrors } from '@apollo/client/errors';
import { t } from '@lingui/core/macro';
@@ -8,7 +8,7 @@ import { IconLifebuoy } from 'twenty-ui/icon';
import { useMutation } from '@apollo/client/react';
import { UpdateWorkspaceDocument } from '~/generated-metadata/graphql';
-export const Toggle2FA = () => {
+export const TwoFactorAuthenticationSwitch = () => {
const { enqueueErrorSnackBar } = useSnackBar();
const [currentWorkspace, setCurrentWorkspace] = useAtomState(
currentWorkspaceState,
@@ -51,7 +51,7 @@ export const Toggle2FA = () => {
return (
<>
{currentWorkspace && (
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconLifebuoy}
title={t`Two Factor Authentication`}
description={t`Enforce two-step verification for every user login.`}
diff --git a/packages/twenty-front/src/modules/settings/workspace/components/ToggleImpersonate.tsx b/packages/twenty-front/src/modules/settings/workspace/components/ImpersonationSwitch.tsx
similarity index 89%
rename from packages/twenty-front/src/modules/settings/workspace/components/ToggleImpersonate.tsx
rename to packages/twenty-front/src/modules/settings/workspace/components/ImpersonationSwitch.tsx
index cec171e3150..4cc7d4e5cb1 100644
--- a/packages/twenty-front/src/modules/settings/workspace/components/ToggleImpersonate.tsx
+++ b/packages/twenty-front/src/modules/settings/workspace/components/ImpersonationSwitch.tsx
@@ -1,6 +1,6 @@
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { CombinedGraphQLErrors } from '@apollo/client/errors';
import { t } from '@lingui/core/macro';
@@ -9,7 +9,7 @@ import { Card } from 'twenty-ui/surfaces';
import { useMutation } from '@apollo/client/react';
import { UpdateWorkspaceDocument } from '~/generated-metadata/graphql';
-export const ToggleImpersonate = () => {
+export const ImpersonationSwitch = () => {
const { enqueueErrorSnackBar } = useSnackBar();
const [currentWorkspace, setCurrentWorkspace] = useAtomState(
@@ -43,7 +43,7 @@ export const ToggleImpersonate = () => {
return (
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconLifebuoy}
title={t`Allow Support Team Access`}
description={t`Grant access to your workspace so we can troubleshoot problems.`}
diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelObjectFilterDropdownContent.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelObjectFilterDropdownContent.tsx
index 5fe8a7c9aac..eb9b42f3ebe 100644
--- a/packages/twenty-front/src/modules/side-panel/components/SidePanelObjectFilterDropdownContent.tsx
+++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelObjectFilterDropdownContent.tsx
@@ -3,7 +3,7 @@ import { useState } from 'react';
import { OBJECTS_WITH_CHANNEL_VISIBILITY_CONSTRAINTS } from 'twenty-shared/constants';
import { TintedIconTile } from 'twenty-ui/data-display';
import { IconCube } from 'twenty-ui/icon';
-import { MenuItemSelectAvatar, MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSelectAvatar, MenuItemSwitch } from 'twenty-ui/navigation';
import { ObjectMetadataIcon } from '@/object-metadata/components/ObjectMetadataIcon';
import { useReadableObjectMetadataItems } from '@/object-metadata/hooks/useReadableObjectMetadataItems';
@@ -131,14 +131,14 @@ export const SidePanelObjectFilterDropdownContent = ({
</SelectableList>
<DropdownMenuSeparator />
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconCube}
- onToggleChange={() =>
+ onCheckedChange={() =>
setSidePanelShowHiddenObjects(!sidePanelShowHiddenObjects)
}
- toggled={sidePanelShowHiddenObjects}
+ checked={sidePanelShowHiddenObjects}
text={t`Show hidden objects`}
- toggleSize="small"
+ size="sm"
/>
</DropdownMenuItemsContainer>
</DropdownContent>
diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/NewFieldDefaultVisibilityToggle.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/NewFieldDefaultVisibilitySwitch.tsx
similarity index 77%
rename from packages/twenty-front/src/modules/side-panel/pages/page-layout/components/NewFieldDefaultVisibilityToggle.tsx
rename to packages/twenty-front/src/modules/side-panel/pages/page-layout/components/NewFieldDefaultVisibilitySwitch.tsx
index e9fc79927c7..243d49c5da9 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/NewFieldDefaultVisibilityToggle.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/NewFieldDefaultVisibilitySwitch.tsx
@@ -1,11 +1,11 @@
-import { CommandMenuItemToggle } from '@/command-menu/components/CommandMenuItemToggle';
+import { CommandMenuItemSwitch } from '@/command-menu/components/CommandMenuItemSwitch';
import { useGetNewFieldDefaultVisibility } from '@/page-layout/widgets/fields/hooks/useGetNewFieldDefaultVisibility';
import { useUpdateNewFieldDefaultVisibility } from '@/page-layout/widgets/fields/hooks/useUpdateNewFieldDefaultVisibility';
import { SelectableListItem } from '@/ui/layout/selectable-list/components/SelectableListItem';
import { useLingui } from '@lingui/react/macro';
import { IconEye } from 'twenty-ui/icon';
-export const NewFieldDefaultVisibilityToggle = ({
+export const NewFieldDefaultVisibilitySwitch = ({
pageLayoutId,
widgetId,
}: {
@@ -25,21 +25,21 @@ export const NewFieldDefaultVisibilityToggle = ({
widgetId,
});
- const handleToggle = () => {
+ const handleCheckedChange = () => {
updateNewFieldDefaultVisibility(!newFieldDefaultVisibility);
};
return (
<SelectableListItem
itemId="new-field-default-visibility"
- onEnter={handleToggle}
+ onEnter={handleCheckedChange}
>
- <CommandMenuItemToggle
+ <CommandMenuItemSwitch
LeftIcon={IconEye}
text={t`Set fields created in the future as "visible"`}
id="new-field-default-visibility"
- toggled={newFieldDefaultVisibility}
- onToggleChange={handleToggle}
+ checked={newFieldDefaultVisibility}
+ onCheckedChange={handleCheckedChange}
/>
</SelectableListItem>
);
diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/chart-settings/ChartSettingItem.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/chart-settings/ChartSettingItem.tsx
index aa6faeeb228..6c523169bfd 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/chart-settings/ChartSettingItem.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/chart-settings/ChartSettingItem.tsx
@@ -2,7 +2,7 @@ import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';
import { CommandMenuItemDropdown } from '@/command-menu/components/CommandMenuItemDropdown';
import { CommandMenuItemNumberInput } from '@/command-menu/components/CommandMenuItemNumberInput';
import { CommandMenuItemTextInput } from '@/command-menu/components/CommandMenuItemTextInput';
-import { CommandMenuItemToggle } from '@/command-menu/components/CommandMenuItemToggle';
+import { CommandMenuItemSwitch } from '@/command-menu/components/CommandMenuItemSwitch';
import { SIDE_PANEL_SELECTABLE_LIST_ID } from '@/side-panel/constants/SidePanelSelectableListId';
import { useSidePanelSubPageHistory } from '@/side-panel/hooks/useSidePanelSubPageHistory';
import { useChartSettingsValues } from '@/side-panel/pages/page-layout/hooks/useChartSettingsValues';
@@ -59,7 +59,7 @@ export const ChartSettingItem = ({
const { updateChartSettingTextInput } =
useUpdateChartSettingTextInput(pageLayoutId);
- const handleToggleChange = () => {
+ const handleCheckedChange = () => {
setSelectedItemId(item.id);
updateChartSettingToggle(item.id);
};
@@ -160,14 +160,14 @@ export const ChartSettingItem = ({
<SelectableListItem
key={item.id}
itemId={item.id}
- onEnter={handleToggleChange}
+ onEnter={handleCheckedChange}
>
- <CommandMenuItemToggle
+ <CommandMenuItemSwitch
LeftIcon={item.Icon}
text={t(item.label)}
id={item.id}
- toggled={getChartSettingsValues(item.id) as boolean}
- onToggleChange={handleToggleChange}
+ checked={getChartSettingsValues(item.id) as boolean}
+ onCheckedChange={handleCheckedChange}
/>
</SelectableListItem>
);
diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dashboard/SidePanelDashboardRecordTableSettings.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dashboard/SidePanelDashboardRecordTableSettings.tsx
index 394a29b1a33..bcad5383786 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dashboard/SidePanelDashboardRecordTableSettings.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/dashboard/SidePanelDashboardRecordTableSettings.tsx
@@ -1,7 +1,7 @@
import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';
import { CommandMenuItemDropdown } from '@/command-menu/components/CommandMenuItemDropdown';
import { CommandMenuItemNumberInput } from '@/command-menu/components/CommandMenuItemNumberInput';
-import { CommandMenuItemToggle } from '@/command-menu/components/CommandMenuItemToggle';
+import { CommandMenuItemSwitch } from '@/command-menu/components/CommandMenuItemSwitch';
import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';
import { pageLayoutDraftComponentState } from '@/page-layout/states/pageLayoutDraftComponentState';
import { useRecordTableWidgetFieldCallbacks } from '@/page-layout/widgets/record-table/hooks/useRecordTableWidgetFieldCallbacks';
@@ -417,12 +417,12 @@ export const SidePanelDashboardRecordTableSettings = () => {
)}
{!isCalendarLayout && hasGroupBy && (
<SelectableListItem itemId="record-table-hide-empty-groups">
- <CommandMenuItemToggle
+ <CommandMenuItemSwitch
LeftIcon={IconEyeOff}
text={t`Hide empty groups`}
id="record-table-hide-empty-groups"
- toggled={shouldHideEmptyGroups}
- onToggleChange={handleShouldHideEmptyGroupsChange}
+ checked={shouldHideEmptyGroups}
+ onCheckedChange={handleShouldHideEmptyGroupsChange}
/>
</SelectableListItem>
)}
@@ -440,12 +440,12 @@ export const SidePanelDashboardRecordTableSettings = () => {
)}
{isWidgetContentEditingSupported && (
<SelectableListItem itemId="record-table-allow-editing">
- <CommandMenuItemToggle
+ <CommandMenuItemSwitch
LeftIcon={IconPencil}
text={t`Allow editing`}
id="record-table-allow-editing"
- toggled={isUIEditable}
- onToggleChange={handleIsUIEditableChange}
+ checked={isUIEditable}
+ onCheckedChange={handleIsUIEditableChange}
/>
</SelectableListItem>
)}
diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-page/SidePanelRecordPageFieldSettings.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-page/SidePanelRecordPageFieldSettings.tsx
index df58dffb52a..0e3048e563e 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-page/SidePanelRecordPageFieldSettings.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-page/SidePanelRecordPageFieldSettings.tsx
@@ -1,6 +1,6 @@
import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';
import { CommandMenuItemDropdown } from '@/command-menu/components/CommandMenuItemDropdown';
-import { CommandMenuItemToggle } from '@/command-menu/components/CommandMenuItemToggle';
+import { CommandMenuItemSwitch } from '@/command-menu/components/CommandMenuItemSwitch';
import { useFieldMetadataItemById } from '@/object-metadata/hooks/useFieldMetadataItemById';
import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';
import { type FieldConfiguration } from '@/page-layout/types/FieldConfiguration';
@@ -271,12 +271,12 @@ export const SidePanelRecordPageFieldSettings = () => {
)}
{isTableDisplayMode && isWidgetContentEditingSupported && (
<SelectableListItem itemId="field-allow-editing">
- <CommandMenuItemToggle
+ <CommandMenuItemSwitch
LeftIcon={IconPencil}
text={t`Allow editing`}
id="field-allow-editing"
- toggled={isUIEditable}
- onToggleChange={handleIsUIEditableChange}
+ checked={isUIEditable}
+ onCheckedChange={handleIsUIEditableChange}
/>
</SelectableListItem>
)}
diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-page/SidePanelRecordPageFieldsSettings.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-page/SidePanelRecordPageFieldsSettings.tsx
index 1a3116dc797..bf6fdd5214a 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-page/SidePanelRecordPageFieldsSettings.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-page/SidePanelRecordPageFieldsSettings.tsx
@@ -1,10 +1,10 @@
import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';
-import { CommandMenuItemToggle } from '@/command-menu/components/CommandMenuItemToggle';
+import { CommandMenuItemSwitch } from '@/command-menu/components/CommandMenuItemSwitch';
import { useFieldsWidgetGroups } from '@/page-layout/widgets/fields/hooks/useFieldsWidgetGroups';
import { SidePanelGroup } from '@/side-panel/components/SidePanelGroup';
import { SidePanelList } from '@/side-panel/components/SidePanelList';
import { useSidePanelSubPageHistory } from '@/side-panel/hooks/useSidePanelSubPageHistory';
-import { NewFieldDefaultVisibilityToggle } from '@/side-panel/pages/page-layout/components/NewFieldDefaultVisibilityToggle';
+import { NewFieldDefaultVisibilitySwitch } from '@/side-panel/pages/page-layout/components/NewFieldDefaultVisibilitySwitch';
import { WidgetSettingsManageSection } from '@/side-panel/pages/page-layout/components/WidgetSettingsManageSection';
import { WidgetSettingsPlacementSection } from '@/side-panel/pages/page-layout/components/WidgetSettingsPlacementSection';
import { WIDGET_SETTINGS_SELECTABLE_ITEM_IDS } from '@/side-panel/pages/page-layout/constants/settings/WidgetSettingsSelectableItemIds';
@@ -116,15 +116,15 @@ export const SidePanelRecordPageFieldsSettings = () => {
itemId="display-more-fields-button"
onEnter={handleToggleShouldAllowUserToSeeHiddenFields}
>
- <CommandMenuItemToggle
+ <CommandMenuItemSwitch
LeftIcon={IconChevronDown}
text={t`Display "More fields" button`}
id="display-more-fields-button"
- toggled={isShouldAllowUserToSeeHiddenFieldsToggled}
- onToggleChange={handleToggleShouldAllowUserToSeeHiddenFields}
+ checked={isShouldAllowUserToSeeHiddenFieldsToggled}
+ onCheckedChange={handleToggleShouldAllowUserToSeeHiddenFields}
/>
</SelectableListItem>
- <NewFieldDefaultVisibilityToggle
+ <NewFieldDefaultVisibilitySwitch
pageLayoutId={pageLayoutId}
widgetId={widgetInEditMode.id}
/>
diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-table-settings/WidgetViewLayoutSettingsRows.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-table-settings/WidgetViewLayoutSettingsRows.tsx
index 602b77edd5c..9dc37ea0f78 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-table-settings/WidgetViewLayoutSettingsRows.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-table-settings/WidgetViewLayoutSettingsRows.tsx
@@ -1,5 +1,5 @@
import { CommandMenuItemDropdown } from '@/command-menu/components/CommandMenuItemDropdown';
-import { CommandMenuItemToggle } from '@/command-menu/components/CommandMenuItemToggle';
+import { CommandMenuItemSwitch } from '@/command-menu/components/CommandMenuItemSwitch';
import { useObjectMetadataItems } from '@/object-metadata/hooks/useObjectMetadataItems';
import { useRecordTableWidgetLayoutCallbacks } from '@/page-layout/widgets/record-table/hooks/useRecordTableWidgetLayoutCallbacks';
import { useRecordTableWidgetViewForDisplay } from '@/page-layout/widgets/record-table/hooks/useRecordTableWidgetViewForDisplay';
@@ -205,12 +205,12 @@ export const WidgetViewLayoutSettingsRows = ({
)}
{!isCalendarLayout && hasGroupBy && (
<SelectableListItem itemId="record-table-hide-empty-groups">
- <CommandMenuItemToggle
+ <CommandMenuItemSwitch
LeftIcon={IconEyeOff}
text={t`Hide empty groups`}
id="record-table-hide-empty-groups"
- toggled={shouldHideEmptyGroups}
- onToggleChange={handleShouldHideEmptyGroupsChange}
+ checked={shouldHideEmptyGroups}
+ onCheckedChange={handleShouldHideEmptyGroupsChange}
/>
</SelectableListItem>
)}
diff --git a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-table-settings/__tests__/WidgetViewLayoutSettingsRows.test.tsx b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-table-settings/__tests__/WidgetViewLayoutSettingsRows.test.tsx
index 0c0859f79a1..3c6ddfeafa8 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-table-settings/__tests__/WidgetViewLayoutSettingsRows.test.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/page-layout/components/record-table-settings/__tests__/WidgetViewLayoutSettingsRows.test.tsx
@@ -47,8 +47,8 @@ jest.mock('@/ui/layout/dropdown/components/DropdownContent', () => ({
jest.mock('@/ui/layout/selectable-list/components/SelectableListItem', () => ({
SelectableListItem: ({ children }: { children: React.ReactNode }) => children,
}));
-jest.mock('@/command-menu/components/CommandMenuItemToggle', () => ({
- CommandMenuItemToggle: () => null,
+jest.mock('@/command-menu/components/CommandMenuItemSwitch', () => ({
+ CommandMenuItemSwitch: () => null,
}));
jest.mock('@/command-menu/components/CommandMenuItemDropdown', () => ({
CommandMenuItemDropdown: ({
diff --git a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/settings/components/SidePanelWorkflowStepSettingsContent.tsx b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/settings/components/SidePanelWorkflowStepSettingsContent.tsx
index 1bd8bb727d3..4004b34e86c 100644
--- a/packages/twenty-front/src/modules/side-panel/pages/workflow/step/settings/components/SidePanelWorkflowStepSettingsContent.tsx
+++ b/packages/twenty-front/src/modules/side-panel/pages/workflow/step/settings/components/SidePanelWorkflowStepSettingsContent.tsx
@@ -3,7 +3,7 @@ import { isDefined } from 'twenty-shared/utils';
import { STEP_RETRY_DELAYS_MS } from 'twenty-shared/workflow';
import { InputLabel } from 'twenty-ui/input';
-import { FormBooleanFieldToggleInput } from '@/object-record/record-field/ui/form-types/components/FormBooleanFieldToggleInput';
+import { FormBooleanFieldSwitchInput } from '@/object-record/record-field/ui/form-types/components/FormBooleanFieldSwitchInput';
import { FormFieldInputContainer } from '@/ui/input/components/FormFieldInputContainer';
import { Select } from '@/ui/input/components/Select';
import { useAtomComponentStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomComponentStateValue';
@@ -60,7 +60,7 @@ const SidePanelWorkflowStepSettingsForm = ({
return (
<WorkflowStepBody>
{step.type !== 'IF_ELSE' && (
- <FormBooleanFieldToggleInput
+ <FormBooleanFieldSwitchInput
description={t`Continue on failure`}
value={errorHandlingOptions.continueOnFailure.value}
onChange={(value) =>
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx
index 6ca041f539a..428142159b9 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/ValidationStep.tsx
@@ -26,7 +26,7 @@ import { themeCssVariables } from 'twenty-ui/theme-constants';
import { type RowsChangeData } from 'react-data-grid';
import { isDefined } from 'twenty-shared/utils';
import { IconTrash } from 'twenty-ui/icon';
-import { Button, Toggle } from 'twenty-ui/input';
+import { Button, Switch } from 'twenty-ui/input';
import { generateColumns } from './components/columns';
import { type ImportedStructuredRowMetadata } from './types';
@@ -61,13 +61,13 @@ const StyledButtonContainer = styled.div`
}
`;
-const StyledErrorToggle = styled.div`
+const StyledErrorSwitch = styled.div`
align-items: center;
display: flex;
flex-direction: row;
`;
-const StyledErrorToggleDescription = styled.span`
+const StyledErrorSwitchDescription = styled.span`
color: ${themeCssVariables.font.color.secondary};
font-size: ${themeCssVariables.font.size.md};
font-weight: ${themeCssVariables.font.weight.regular};
@@ -317,16 +317,17 @@ export const ValidationStep = ({
</StyledScrollContainer>
)}
<StyledToolbar>
- <StyledErrorToggle>
- <Toggle
- value={filterByErrors}
- onChange={() => setFilterByErrors(!filterByErrors)}
- toggleSize="small"
+ <StyledErrorSwitch>
+ <Switch
+ aria-label={t`Show only rows with errors`}
+ checked={filterByErrors}
+ onCheckedChange={() => setFilterByErrors(!filterByErrors)}
+ size="sm"
/>
- <StyledErrorToggleDescription>
+ <StyledErrorSwitchDescription>
<Trans>Show only rows with errors</Trans>
- </StyledErrorToggleDescription>
- </StyledErrorToggle>
+ </StyledErrorSwitchDescription>
+ </StyledErrorSwitch>
<StyledButtonContainer>
<Button
Icon={IconTrash}
diff --git a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx
index 16e750e2c90..8123d23ba5a 100644
--- a/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx
+++ b/packages/twenty-front/src/modules/spreadsheet-import/steps/components/ValidationStep/components/columns.tsx
@@ -13,7 +13,7 @@ import { SettingsTextInput } from '@/ui/input/components/SettingsTextInput';
import camelCase from 'lodash.camelcase';
import { isDefined } from 'twenty-shared/utils';
import { AppTooltip, TooltipDelay } from 'twenty-ui/surfaces';
-import { Checkbox, CheckboxVariant, Toggle } from 'twenty-ui/input';
+import { Checkbox, CheckboxVariant, Switch } from 'twenty-ui/input';
import { type ImportedStructuredRowMetadata } from '@/spreadsheet-import/steps/components/ValidationStep/types';
const StyledHeaderContainer = styled.div`
@@ -41,12 +41,16 @@ const StyledCheckboxContainer = styled.div`
width: 100%;
`;
-const StyledToggleContainer = styled.div`
+const StyledSwitchContainer = styled.div`
align-items: center;
display: flex;
height: 100%;
`;
+const StyledSwitch = styled(Switch)`
+ align-self: center;
+`;
+
const StyledInputContainer = styled.div`
align-items: center;
display: flex;
@@ -175,23 +179,23 @@ export const generateColumns = (
switch (column.fieldType.type) {
case 'checkbox':
component = (
- <StyledToggleContainer
+ <StyledSwitchContainer
id={formatSafeId(`${columnKey}-${row.__index}`)}
onClick={(event) => {
event.stopPropagation();
}}
>
- <Toggle
- centered
- value={row[columnKey] as boolean}
- onChange={() => {
+ <StyledSwitch
+ aria-label={column.label}
+ checked={row[columnKey] as boolean}
+ onCheckedChange={() => {
onRowChange({
...row,
[columnKey]: !row[columnKey],
});
}}
/>
- </StyledToggleContainer>
+ </StyledSwitchContainer>
);
break;
case 'select':
diff --git a/packages/twenty-front/src/modules/ui/input/components/AdvancedSettingsSwitch.tsx b/packages/twenty-front/src/modules/ui/input/components/AdvancedSettingsSwitch.tsx
new file mode 100644
index 00000000000..7e39c519a6a
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/input/components/AdvancedSettingsSwitch.tsx
@@ -0,0 +1,59 @@
+import { styled } from '@linaria/react';
+import { useLingui } from '@lingui/react/macro';
+import { useId } from 'react';
+import { Switch } from 'twenty-ui/input';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+
+const StyledContainer = styled.label`
+ align-items: center;
+ box-sizing: border-box;
+ cursor: pointer;
+ display: flex;
+ height: ${themeCssVariables.spacing[5]};
+ justify-content: space-between;
+ padding: ${themeCssVariables.spacing[1]};
+ width: 100%;
+`;
+
+const StyledText = styled.div`
+ color: ${themeCssVariables.font.color.secondary};
+ font-size: ${themeCssVariables.font.size.sm};
+ font-weight: ${themeCssVariables.font.weight.medium};
+`;
+
+const StyledSwitch = styled(Switch)`
+ ${StyledContainer} & {
+ color: ${themeCssVariables.color.yellow};
+ }
+`;
+
+type AdvancedSettingsSwitchProps = {
+ isAdvancedModeEnabled: boolean;
+ setIsAdvancedModeEnabled: (enabled: boolean) => void;
+ label?: string;
+ className?: string;
+};
+
+export const AdvancedSettingsSwitch = ({
+ isAdvancedModeEnabled,
+ setIsAdvancedModeEnabled,
+ label,
+ className,
+}: AdvancedSettingsSwitchProps) => {
+ const { t } = useLingui();
+ const onChange = (newValue: boolean) => {
+ setIsAdvancedModeEnabled(newValue);
+ };
+ const instanceId = useId();
+
+ return (
+ <StyledContainer className={className} htmlFor={instanceId}>
+ <StyledText>{label ?? t`Advanced`}</StyledText>
+ <StyledSwitch
+ id={instanceId}
+ onCheckedChange={onChange}
+ checked={isAdvancedModeEnabled}
+ />
+ </StyledContainer>
+ );
+};
diff --git a/packages/twenty-front/src/modules/ui/input/components/__stories__/AdvancedSettingsSwitch.stories.tsx b/packages/twenty-front/src/modules/ui/input/components/__stories__/AdvancedSettingsSwitch.stories.tsx
new file mode 100644
index 00000000000..e89174c83cd
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/input/components/__stories__/AdvancedSettingsSwitch.stories.tsx
@@ -0,0 +1,69 @@
+import { AdvancedSettingsSwitch } from '@/ui/input/components/AdvancedSettingsSwitch';
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { type ComponentProps, useState } from 'react';
+import { expect, fn, userEvent, within } from 'storybook/test';
+import { ComponentDecorator } from 'twenty-ui/testing';
+import { ThemeProvider } from 'twenty-ui/theme-constants';
+
+type ControlledAdvancedSettingsSwitchProps = ComponentProps<
+ typeof AdvancedSettingsSwitch
+>;
+
+const ControlledAdvancedSettingsSwitch = ({
+ isAdvancedModeEnabled,
+ setIsAdvancedModeEnabled,
+ ...props
+}: ControlledAdvancedSettingsSwitchProps) => {
+ const [enabled, setEnabled] = useState(isAdvancedModeEnabled);
+
+ return (
+ <AdvancedSettingsSwitch
+ {...props}
+ isAdvancedModeEnabled={enabled}
+ setIsAdvancedModeEnabled={(nextEnabled) => {
+ setEnabled(nextEnabled);
+ setIsAdvancedModeEnabled(nextEnabled);
+ }}
+ />
+ );
+};
+
+const meta: Meta<typeof AdvancedSettingsSwitch> = {
+ title: 'UI/Input/AdvancedSettingsSwitch',
+ component: AdvancedSettingsSwitch,
+ decorators: [ComponentDecorator],
+ parameters: { container: { width: 300 } },
+ args: {
+ isAdvancedModeEnabled: false,
+ setIsAdvancedModeEnabled: fn(),
+ },
+ render: (args) => <ControlledAdvancedSettingsSwitch {...args} />,
+};
+
+export default meta;
+type Story = StoryObj<typeof AdvancedSettingsSwitch>;
+
+export const Default: Story = {
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const control = canvas.getByRole('switch', { name: 'Advanced' });
+ await userEvent.click(canvas.getByText('Advanced'));
+ await expect(control).toBeChecked();
+ await expect(args.setIsAdvancedModeEnabled).toHaveBeenLastCalledWith(true);
+ await userEvent.click(control);
+ await expect(control).not.toBeChecked();
+ await expect(args.setIsAdvancedModeEnabled).toHaveBeenLastCalledWith(false);
+ await expect(args.setIsAdvancedModeEnabled).toHaveBeenCalledTimes(2);
+ },
+};
+
+export const Dark: Story = {
+ ...Default,
+ decorators: [
+ (Story) => (
+ <ThemeProvider colorScheme="dark" applyToRoot={false}>
+ <Story />
+ </ThemeProvider>
+ ),
+ ],
+};
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx
index e1536b83785..4006bf5b3e7 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/NavigationDrawer.stories.tsx
@@ -3,6 +3,7 @@ import { useEffect } from 'react';
import { expect, within } from 'storybook/test';
import { currentWorkspaceMemberState } from '@/auth/states/currentWorkspaceMemberState';
+import { AdvancedSettingsSwitch } from '@/ui/input/components/AdvancedSettingsSwitch';
import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
import { setTestObjectMetadataItemsInMetadataStore } from '~/testing/utils/setTestObjectMetadataItemsInMetadataStore';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
@@ -34,7 +35,6 @@ import {
IconUserCircle,
IconUsers,
} from 'twenty-ui/icon';
-import { AdvancedSettingsToggle } from 'twenty-ui/input';
import { getOsControlSymbol } from 'twenty-ui/utilities';
import { NavigationDrawer } from '@/ui/navigation/navigation-drawer/components/NavigationDrawer';
@@ -182,7 +182,7 @@ export const Settings: Story = {
</NavigationDrawerSection>
<NavigationDrawerFixedContent>
- <AdvancedSettingsToggle
+ <AdvancedSettingsSwitch
isAdvancedModeEnabled={false}
setIsAdvancedModeEnabled={() => {}}
label="Advanced:"
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateCalendarEvent.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateCalendarEvent.tsx
index c148bd2bf30..790cb2a1fac 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateCalendarEvent.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/components/WorkflowEditActionCreateCalendarEvent.tsx
@@ -1,6 +1,6 @@
import { getMissingCreateCalendarEventScopes } from '@/accounts/utils/hasMissingCreateCalendarEventScopes';
import { isCalendarCreationEnabledForAccount } from '@/activities/calendar/utils/isCalendarCreationEnabledForAccount';
-import { FormBooleanFieldToggleInput } from '@/object-record/record-field/ui/form-types/components/FormBooleanFieldToggleInput';
+import { FormBooleanFieldSwitchInput } from '@/object-record/record-field/ui/form-types/components/FormBooleanFieldSwitchInput';
import { FormDateTimeFieldInput } from '@/object-record/record-field/ui/form-types/components/FormDateTimeFieldInput';
import { FormMultiTextFieldInput } from '@/object-record/record-field/ui/form-types/components/FormMultiTextFieldInput';
import { FormSelectFieldInput } from '@/object-record/record-field/ui/form-types/components/FormSelectFieldInput';
@@ -180,7 +180,7 @@ export const WorkflowEditActionCreateCalendarEvent = ({
readonly={actionOptions.readonly}
VariablePicker={WorkflowVariablePicker}
/>
- <FormBooleanFieldToggleInput
+ <FormBooleanFieldSwitchInput
label={t`All day`}
description={t`Create the event as an all-day event`}
value={formData.isFullDay}
@@ -195,7 +195,7 @@ export const WorkflowEditActionCreateCalendarEvent = ({
onChange={(value) => handleFieldChange('attendees', value)}
VariablePicker={WorkflowVariablePicker}
/>
- <FormBooleanFieldToggleInput
+ <FormBooleanFieldSwitchInput
label={t`Send invitations`}
description={t`Email the attendees an invitation`}
hint={t`When off, the event is created with no attendees and nobody is notified.`}
@@ -203,7 +203,7 @@ export const WorkflowEditActionCreateCalendarEvent = ({
onChange={(value) => handleFieldChange('sendInvitations', value)}
disabled={actionOptions.readonly}
/>
- <FormBooleanFieldToggleInput
+ <FormBooleanFieldSwitchInput
label={t`Add conferencing`}
description={t`Add a video conferencing link`}
hint={t`Generates a Google Meet or Microsoft Teams link depending on the account.`}
diff --git a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/iterator-action/components/WorkflowEditActionIterator.tsx b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/iterator-action/components/WorkflowEditActionIterator.tsx
index 262a44a2edc..c517f788305 100644
--- a/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/iterator-action/components/WorkflowEditActionIterator.tsx
+++ b/packages/twenty-front/src/modules/workflow/workflow-steps/workflow-actions/iterator-action/components/WorkflowEditActionIterator.tsx
@@ -1,5 +1,5 @@
import { FormArrayFieldInput } from '@/object-record/record-field/ui/form-types/components/FormArrayFieldInput';
-import { FormBooleanFieldToggleInput } from '@/object-record/record-field/ui/form-types/components/FormBooleanFieldToggleInput';
+import { FormBooleanFieldSwitchInput } from '@/object-record/record-field/ui/form-types/components/FormBooleanFieldSwitchInput';
import { type FieldArrayValue } from '@/object-record/record-field/ui/types/FieldMetadata';
import { type WorkflowIteratorAction } from '@/workflow/types/Workflow';
import { isStandaloneVariableString } from 'twenty-shared/workflow';
@@ -109,7 +109,7 @@ export const WorkflowEditActionIterator = ({
readonly={actionOptions.readonly}
VariablePicker={WorkflowVariablePicker}
/>
- <FormBooleanFieldToggleInput
+ <FormBooleanFieldSwitchInput
description={t`Continue on iteration failure`}
value={formData.shouldContinueOnIterationFailure}
onChange={(value) =>
diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationGeneralToggles.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationGeneralSwitches.tsx
similarity index 86%
rename from packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationGeneralToggles.tsx
rename to packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationGeneralSwitches.tsx
index 551198a5005..5a45e9ea23d 100644
--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationGeneralToggles.tsx
+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminApplicationRegistrationGeneralSwitches.tsx
@@ -1,6 +1,6 @@
import { Section } from 'twenty-ui/layout';
import { Card } from 'twenty-ui/surfaces';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { IconArrowBarToDown, IconPinned, IconShield } from 'twenty-ui/icon';
import { H2Title } from 'twenty-ui/typography';
import { type ApplicationRegistration } from '~/generated-metadata/graphql';
@@ -11,13 +11,13 @@ import { useMutation } from '@apollo/client/react';
import { useLingui } from '@lingui/react/macro';
import { useApolloAdminClient } from '@/settings/admin-panel/apollo/hooks/useApolloAdminClient';
-const StyledToggleContainer = styled.div`
+const StyledSwitchContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${themeCssVariables.spacing[3]};
`;
-export const SettingsAdminApplicationRegistrationGeneralToggles = ({
+export const SettingsAdminApplicationRegistrationGeneralSwitches = ({
registration,
}: {
registration: ApplicationRegistration;
@@ -33,9 +33,9 @@ export const SettingsAdminApplicationRegistrationGeneralToggles = ({
return (
<Section>
<H2Title title={t`Installation`} />
- <StyledToggleContainer>
+ <StyledSwitchContainer>
<Card rounded fullWidth>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconArrowBarToDown}
title={t`Allow installation`}
description={t`Display this app in the NPM packages list`}
@@ -53,7 +53,7 @@ export const SettingsAdminApplicationRegistrationGeneralToggles = ({
/>
</Card>
<Card rounded fullWidth>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconShield}
title={t`Vetted`}
description={t`Mark this app as reviewed and approved`}
@@ -71,7 +71,7 @@ export const SettingsAdminApplicationRegistrationGeneralToggles = ({
/>
</Card>
<Card rounded fullWidth>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconPinned}
title={t`Pre-install on new workspaces`}
description={t`Automatically install this app on every newly created workspace`}
@@ -88,7 +88,7 @@ export const SettingsAdminApplicationRegistrationGeneralToggles = ({
}
/>
</Card>
- </StyledToggleContainer>
+ </StyledSwitchContainer>
</Section>
);
};
diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx
index 8ad64587df8..4b40a5f6d32 100644
--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx
+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminNewAiModel.tsx
@@ -28,7 +28,7 @@ import { TextInput } from '@/ui/input/components/TextInput';
import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';
import { useCustomAiProviderAccess } from '@/settings/admin-panel/ai/hooks/useCustomAiProviderAccess';
import { OrganizationAdornment } from '~/pages/settings/enterprise/components/OrganizationAdornment';
-import { Checkbox, Toggle } from 'twenty-ui/input';
+import { Checkbox, Switch } from 'twenty-ui/input';
const StyledComboInputContainer = styled.div`
display: flex;
@@ -603,7 +603,11 @@ export const SettingsAdminNewAiModel = () => {
name="supportsReasoning"
control={form.control}
render={({ field: { onChange, value } }) => (
- <Toggle value={value} onChange={onChange} />
+ <Switch
+ aria-label={t`Supports reasoning`}
+ checked={value}
+ onCheckedChange={onChange}
+ />
)}
/>
</Section>
diff --git a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
index 4db73a07ae2..79dc638a1af 100644
--- a/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
+++ b/packages/twenty-front/src/pages/settings/admin-panel/SettingsAdminWorkspaceDetail.tsx
@@ -44,7 +44,7 @@ import {
} from 'twenty-ui/icon';
import { Card, OverflowingTextWithTooltip } from 'twenty-ui/surfaces';
import { H2Title } from 'twenty-ui/typography';
-import { Button, Toggle } from 'twenty-ui/input';
+import { Button, Switch } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { getAbsoluteImageUrl } from '~/utils/image/getAbsoluteImageUrl';
@@ -359,9 +359,10 @@ export const SettingsAdminWorkspaceDetail = () => {
<TableCell>{flag.key}</TableCell>
<TableCell align="right">
{isDefined(flag.key) && (
- <Toggle
- value={displayedValue}
- onChange={(newValue) =>
+ <Switch
+ aria-label={flag.key}
+ checked={displayedValue}
+ onCheckedChange={(newValue) =>
handleFeatureFlagUpdate(flag.key!, newValue)
}
/>
diff --git a/packages/twenty-front/src/pages/settings/ai/SettingsSkillForm.tsx b/packages/twenty-front/src/pages/settings/ai/SettingsSkillForm.tsx
index a1e2c39c877..eafab11f8a9 100644
--- a/packages/twenty-front/src/pages/settings/ai/SettingsSkillForm.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/SettingsSkillForm.tsx
@@ -8,7 +8,7 @@ import { AI_INSTRUCTIONS_EDITOR_PROFILE } from '@/ai/constants/AiInstructionsEdi
import { AdvancedSettingsWrapper } from '@/settings/components/AdvancedSettingsWrapper';
import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';
import { SettingsEditableTitle } from '@/settings/components/SettingsEditableTitle';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { IconPicker } from '@/ui/input/components/IconPicker';
@@ -543,7 +543,7 @@ export const SettingsSkillForm = ({ mode }: { mode: 'create' | 'edit' }) => {
}
/>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconRefresh}
title={t`Synchronize Label and API Name`}
description={t`Should changing the label also change the API name?`}
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx
index c1d5e1ff4da..4e2df119788 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentSkillsTab.tsx
@@ -9,7 +9,7 @@ import { useMemo, useState } from 'react';
import { IconArchive } from 'twenty-ui/icon';
import { H2Title } from 'twenty-ui/typography';
import { SearchInput } from 'twenty-ui/input';
-import { MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSwitch } from 'twenty-ui/navigation';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useMutation, useQuery } from '@apollo/client/react';
@@ -104,12 +104,12 @@ export const SettingsAgentSkillsTab = () => {
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconArchive}
- onToggleChange={setShowDeactivated}
- toggled={showDeactivated}
+ onCheckedChange={setShowDeactivated}
+ checked={showDeactivated}
text={t`Deactivated`}
- toggleSize="small"
+ size="sm"
/>
</DropdownMenuItemsContainer>
</DropdownContent>
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx
index 06a5a907fda..890d3f30cbe 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAgentToolsTab.tsx
@@ -10,7 +10,7 @@ import { IconLock, IconPuzzle, IconTool } from 'twenty-ui/icon';
import { H2Title } from 'twenty-ui/typography';
import { SearchInput } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
-import { MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSwitch } from 'twenty-ui/navigation';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { SettingsAgentToolsTable } from '~/pages/settings/ai/components/SettingsAgentToolsTable';
import { useSettingsAgentToolsTable } from '~/pages/settings/ai/hooks/useSettingsAgentToolsTable';
@@ -91,26 +91,26 @@ export const SettingsAgentToolsTab = () => {
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconTool}
- onToggleChange={setShowCustomTools}
- toggled={showCustomTools}
+ onCheckedChange={setShowCustomTools}
+ checked={showCustomTools}
text={t`Custom`}
- toggleSize="small"
+ size="sm"
/>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconLock}
- onToggleChange={setShowManagedTools}
- toggled={showManagedTools}
+ onCheckedChange={setShowManagedTools}
+ checked={showManagedTools}
text={t`Managed`}
- toggleSize="small"
+ size="sm"
/>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconPuzzle}
- onToggleChange={setShowStandardTools}
- toggled={showStandardTools}
+ onCheckedChange={setShowStandardTools}
+ checked={showStandardTools}
text={t`Standard`}
- toggleSize="small"
+ size="sm"
/>
</DropdownMenuItemsContainer>
</DropdownContent>
diff --git a/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelsTab.tsx b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelsTab.tsx
index 94c535ec609..9c7cadcf8ff 100644
--- a/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelsTab.tsx
+++ b/packages/twenty-front/src/pages/settings/ai/components/SettingsAiModelsTab.tsx
@@ -9,7 +9,7 @@ import { getDataResidencyDisplay } from '@/settings/ai/utils/getDataResidencyDis
import { getModelIcon } from '@/settings/ai/utils/getModelIcon';
import { SettingsCard } from '@/settings/components/SettingsCard';
import { SettingsOptionCardContentSelect } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSelect';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { Select } from '@/ui/input/components/Select';
import { GenericDropdownContentWidth } from '@/ui/layout/dropdown/constants/GenericDropdownContentWidth';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
@@ -158,7 +158,7 @@ export const SettingsAiModelsTab = () => {
description={t`Models available in the agent node and chat model pickers`}
/>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconStar}
title={t`Use best models only`}
description={t`Restrict available models to a curated list`}
diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationGeneralSection.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationGeneralSection.tsx
index 1861fa1de74..47bc483ad07 100644
--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationGeneralSection.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationGeneralSection.tsx
@@ -1,4 +1,4 @@
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
import { useMutation } from '@apollo/client/react';
import { t } from '@lingui/core/macro';
@@ -38,7 +38,7 @@ export const SettingsApplicationGeneralSection = ({
<Section>
<H2Title title={t`General`} />
<Card rounded fullWidth>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconRefresh}
title={t`Auto-upgrade`}
description={t`Automatically upgrade this application when a new version is published`}
diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationGeneralTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationGeneralTab.tsx
index b89de2ee8e5..420fa6d072a 100644
--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationGeneralTab.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationRegistrationGeneralTab.tsx
@@ -8,7 +8,7 @@ import { SettingsApplicationRegistrationGeneralInfo } from '~/pages/settings/app
import { SettingsAdminApplicationRegistrationClaims } from '~/pages/settings/admin-panel/SettingsAdminApplicationRegistrationClaims';
import { SettingsAdminApplicationRegistrationDangerZone } from '~/pages/settings/admin-panel/SettingsAdminApplicationRegistrationDangerZone';
import { SettingsApplicationRegistrationGeneralStats } from '~/pages/settings/applications/components/SettingsApplicationRegistrationGeneralStats';
-import { SettingsAdminApplicationRegistrationGeneralToggles } from '~/pages/settings/admin-panel/SettingsAdminApplicationRegistrationGeneralToggles';
+import { SettingsAdminApplicationRegistrationGeneralSwitches } from '~/pages/settings/admin-panel/SettingsAdminApplicationRegistrationGeneralSwitches';
export const SettingsApplicationRegistrationGeneralTab = ({
registration,
@@ -39,7 +39,7 @@ export const SettingsApplicationRegistrationGeneralTab = ({
)}
<SettingsApplicationRegistrationGeneralInfo registration={registration} />
{fromAdmin && (
- <SettingsAdminApplicationRegistrationGeneralToggles
+ <SettingsAdminApplicationRegistrationGeneralSwitches
registration={registration}
/>
)}
diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationTimelineActivityTypeSettingsTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationTimelineActivityTypeSettingsTab.tsx
index 499933ed6b0..b1ce546d73a 100644
--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationTimelineActivityTypeSettingsTab.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationTimelineActivityTypeSettingsTab.tsx
@@ -1,4 +1,4 @@
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { Table } from '@/ui/layout/table/components/Table';
import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableHeader } from '@/ui/layout/table/components/TableHeader';
@@ -118,7 +118,7 @@ export const SettingsApplicationTimelineActivityTypeSettingsTab = ({
description={t`Choose whether this activity type appears in record timelines`}
/>
<Card rounded fullWidth>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconTimelineEvent}
title={t`Active`}
description={t`Show this activity type in record timelines`}
diff --git a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx
index 907154f496e..34990bc6a4e 100644
--- a/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx
+++ b/packages/twenty-front/src/pages/settings/applications/tabs/SettingsApplicationsAvailableTab.tsx
@@ -9,7 +9,7 @@ import { InlineBanner } from 'twenty-ui/feedback';
import { IconSparkles } from 'twenty-ui/icon';
import { SearchInput } from 'twenty-ui/input';
import { Section } from 'twenty-ui/layout';
-import { MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSwitch } from 'twenty-ui/navigation';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useMarketplaceApps } from '~/modules/marketplace/hooks/useMarketplaceApps';
import { SettingsAvailableApplicationCard } from '~/pages/settings/applications/components/SettingsAvailableApplicationCard';
@@ -106,12 +106,12 @@ export const SettingsApplicationsAvailableTab = () => {
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconSparkles}
- onToggleChange={() => setShowVettedOnly(!showVettedOnly)}
- toggled={showVettedOnly}
+ onCheckedChange={() => setShowVettedOnly(!showVettedOnly)}
+ checked={showVettedOnly}
text={t`Vetted only`}
- toggleSize="small"
+ size="sm"
/>
</DropdownMenuItemsContainer>
</DropdownContent>
diff --git a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceNewUnsubscribeTopic.tsx b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceNewUnsubscribeTopic.tsx
index 9f952fc16c2..42a66aad082 100644
--- a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceNewUnsubscribeTopic.tsx
+++ b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceNewUnsubscribeTopic.tsx
@@ -5,7 +5,7 @@ import { useCreateUnsubscribeTopic } from '@/settings/unsubscribe-topics/hooks/u
import { SETTINGS_UNSUBSCRIBE_TAB_IDS } from '@/settings/unsubscribers/constants/SettingsUnsubscribeTabIds';
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons/SaveAndCancelButtons';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';
import { useSnackBar } from '@/ui/feedback/snack-bar-manager/hooks/useSnackBar';
@@ -154,7 +154,7 @@ export const SettingsWorkspaceNewUnsubscribeTopic = () => {
description={t`Control whether recipients can find and manage this topic.`}
/>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconEye}
title={t`Listed on the unsubscribe page`}
description={t`Public topics appear on the recipient preferences page.`}
diff --git a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx
index c85c65d1cd5..718db96edd6 100644
--- a/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx
+++ b/packages/twenty-front/src/pages/settings/communications/SettingsWorkspaceUnsubscribeTopicDetail.tsx
@@ -6,7 +6,7 @@ import { useUnsubscribeTopics } from '@/activities/emails/hooks/useUnsubscribeTo
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import { SettingsSkeletonLoader } from '@/settings/components/SettingsSkeletonLoader';
-import { SettingsOptionCardContentToggle } from '@/settings/components/SettingsOptions/SettingsOptionCardContentToggle';
+import { SettingsOptionCardContentSwitch } from '@/settings/components/SettingsOptions/SettingsOptionCardContentSwitch';
import { SettingsPageLayout } from '@/settings/components/layout/SettingsPageLayout';
import { useDeleteUnsubscribeTopic } from '@/settings/unsubscribe-topics/hooks/useDeleteUnsubscribeTopic';
import { useUpdateUnsubscribeTopic } from '@/settings/unsubscribe-topics/hooks/useUpdateUnsubscribeTopic';
@@ -191,7 +191,7 @@ export const SettingsWorkspaceUnsubscribeTopicDetail = () => {
description={t`Control whether recipients can find and manage this topic.`}
/>
<Card rounded>
- <SettingsOptionCardContentToggle
+ <SettingsOptionCardContentSwitch
Icon={IconEye}
title={t`Listed on the unsubscribe page`}
description={t`Public topics appear on the recipient preferences page.`}
diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx
index 96f755202cb..ecc9b403a32 100644
--- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx
+++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectFieldTable.tsx
@@ -27,7 +27,7 @@ import { useEffect, useMemo, useState } from 'react';
import { FieldMetadataType } from 'twenty-shared/types';
import { IconArchive, IconCircleDashed, IconSettings } from 'twenty-ui/icon';
import { SearchInput } from 'twenty-ui/input';
-import { MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSwitch } from 'twenty-ui/navigation';
import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useMostlyEmptyFieldMetadataIds } from '@/settings/data-model/object-details/hooks/useMostlyEmptyFieldMetadataIds';
import { useMapFieldMetadataItemToSettingsObjectDetailTableItem } from '~/pages/settings/data-model/hooks/useMapFieldMetadataItemToSettingsObjectDetailTableItem';
@@ -183,34 +183,34 @@ export const SettingsObjectFieldTable = ({
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconArchive}
- onToggleChange={() => setShowInactive(!showInactive)}
- toggled={showInactive}
+ onCheckedChange={() => setShowInactive(!showInactive)}
+ checked={showInactive}
text={t`Inactive`}
- toggleSize="small"
+ size="sm"
/>
{(mostlyEmptyFieldMetadataIds.size > 0 ||
showOnlyMostlyEmpty) && (
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconCircleDashed}
- onToggleChange={() =>
+ onCheckedChange={() =>
setShowOnlyMostlyEmpty(!showOnlyMostlyEmpty)
}
- toggled={showOnlyMostlyEmpty}
+ checked={showOnlyMostlyEmpty}
text={t`Mostly empty`}
- toggleSize="small"
+ size="sm"
/>
)}
{isAdvancedModeEnabled && (
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconSettings}
- onToggleChange={() =>
+ onCheckedChange={() =>
setShowSystemFields(!showSystemFields)
}
- toggled={showSystemFields}
+ checked={showSystemFields}
text={t`System fields`}
- toggleSize="small"
+ size="sm"
/>
)}
</DropdownMenuItemsContainer>
diff --git a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx
index 9f0e6ef23d1..2f0dcaa909a 100644
--- a/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx
+++ b/packages/twenty-front/src/pages/settings/data-model/SettingsObjectTable.tsx
@@ -32,7 +32,7 @@ import { SettingsPath } from 'twenty-shared/types';
import { getSettingsPath } from 'twenty-shared/utils';
import { IconArchive, IconChevronRight, IconSettings } from 'twenty-ui/icon';
import { SearchInput } from 'twenty-ui/input';
-import { MenuItemToggle } from 'twenty-ui/navigation';
+import { MenuItemSwitch } from 'twenty-ui/navigation';
import {
MOBILE_VIEWPORT,
ThemeContext,
@@ -176,24 +176,24 @@ export const SettingsObjectTable = ({
dropdownComponents={
<DropdownContent>
<DropdownMenuItemsContainer>
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconArchive}
- onToggleChange={() =>
+ onCheckedChange={() =>
setShowDeactivated(!showDeactivated)
}
- toggled={showDeactivated}
+ checked={showDeactivated}
text={t`Deactivated`}
- toggleSize="small"
+ size="sm"
/>
{isAdvancedModeEnabled && (
- <MenuItemToggle
+ <MenuItemSwitch
LeftIcon={IconSettings}
- onToggleChange={() =>
+ onCheckedChange={() =>
setShowSystemObjects(!showSystemObjects)
}
- toggled={showSystemObjects}
+ checked={showSystemObjects}
text={t`System objects`}
- toggleSize="small"
+ size="sm"
/>
)}
</DropdownMenuItemsContainer>
diff --git a/packages/twenty-ui/README.md b/packages/twenty-ui/README.md
index e4110cfa748..6ede1628fe1 100644
--- a/packages/twenty-ui/README.md
+++ b/packages/twenty-ui/README.md
@@ -49,7 +49,7 @@ import { Button } from 'twenty-ui/input';
| `twenty-ui/data-display` | Avatars, chips, tags, and other display components |
| `twenty-ui/feedback` | Progress bars, loaders, and status feedback |
| `twenty-ui/icon` | Icon components and the icon provider |
-| `twenty-ui/input` | Buttons, toggles, and form inputs |
+| `twenty-ui/input` | Buttons, switches, and form inputs |
| `twenty-ui/json-visualizer` | JSON tree viewer |
| `twenty-ui/layout` | Layout primitives |
| `twenty-ui/navigation` | Menus, links, and navigation components |
diff --git a/packages/twenty-ui/src/input/AdvancedSettingsToggle/AdvancedSettingsToggle.module.scss b/packages/twenty-ui/src/input/AdvancedSettingsToggle/AdvancedSettingsToggle.module.scss
deleted file mode 100644
index 29180b04bc6..00000000000
--- a/packages/twenty-ui/src/input/AdvancedSettingsToggle/AdvancedSettingsToggle.module.scss
+++ /dev/null
@@ -1,16 +0,0 @@
-.container {
- align-items: center;
- box-sizing: border-box;
- cursor: pointer;
- display: flex;
- height: var(--t-spacing-5);
- justify-content: space-between;
- padding: var(--t-spacing-1);
- width: 100%;
-}
-
-.text {
- color: var(--t-font-color-secondary);
- font-size: var(--t-font-size-sm);
- font-weight: var(--t-font-weight-medium);
-}
diff --git a/packages/twenty-ui/src/input/AdvancedSettingsToggle/AdvancedSettingsToggle.module.scss.d.ts b/packages/twenty-ui/src/input/AdvancedSettingsToggle/AdvancedSettingsToggle.module.scss.d.ts
deleted file mode 100644
index 844a12b158f..00000000000
--- a/packages/twenty-ui/src/input/AdvancedSettingsToggle/AdvancedSettingsToggle.module.scss.d.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-declare const classNames: {
- readonly container: 'container';
- readonly text: 'text';
-};
-export default classNames;
diff --git a/packages/twenty-ui/src/input/AdvancedSettingsToggle/AdvancedSettingsToggle.tsx b/packages/twenty-ui/src/input/AdvancedSettingsToggle/AdvancedSettingsToggle.tsx
deleted file mode 100644
index 61a3fd155f3..00000000000
--- a/packages/twenty-ui/src/input/AdvancedSettingsToggle/AdvancedSettingsToggle.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { Toggle } from '@ui/input';
-import { useTheme } from '@ui/theme-constants';
-import { clsx } from 'clsx';
-import { useId } from 'react';
-
-import styles from './AdvancedSettingsToggle.module.scss';
-
-type AdvancedSettingsToggleProps = {
- isAdvancedModeEnabled: boolean;
- setIsAdvancedModeEnabled: (enabled: boolean) => void;
- label?: string;
- className?: string;
-};
-
-export const AdvancedSettingsToggle = ({
- isAdvancedModeEnabled,
- setIsAdvancedModeEnabled,
- label = 'Advanced',
- className,
-}: AdvancedSettingsToggleProps) => {
- const theme = useTheme();
-
- const onChange = (newValue: boolean) => {
- setIsAdvancedModeEnabled(newValue);
- };
- const instanceId = useId();
-
- return (
- <label className={clsx(styles.container, className)} htmlFor={instanceId}>
- <div className={styles.text}>{label}</div>
- <Toggle
- id={instanceId}
- onChange={onChange}
- color={theme.color.yellow}
- value={isAdvancedModeEnabled}
- />
- </label>
- );
-};
diff --git a/packages/twenty-ui/src/input/Switch/Switch.module.scss b/packages/twenty-ui/src/input/Switch/Switch.module.scss
new file mode 100644
index 00000000000..59570042d2e
--- /dev/null
+++ b/packages/twenty-ui/src/input/Switch/Switch.module.scss
@@ -0,0 +1,67 @@
+.root {
+ @include focus-ring;
+
+ position: relative;
+ display: inline-flex;
+ box-sizing: border-box;
+ flex-shrink: 0;
+ align-items: center;
+ align-self: flex-start;
+ padding: 0;
+ border: 0;
+ border-radius: var(--t-border-radius-pill);
+ corner-shape: round;
+ appearance: none;
+ background-color: var(--t-background-transparent-medium);
+ color: var(--t-color-blue);
+ cursor: pointer;
+ transition: background-color duration(normal) ease;
+
+ &[data-checked] {
+ background-color: currentColor;
+ }
+
+ &[data-disabled] {
+ opacity: 0.5;
+ cursor: default;
+ }
+
+ &[data-readonly] {
+ cursor: default;
+ }
+}
+
+.sm {
+ --tw-switch-thumb-size: 12px;
+
+ inline-size: 24px;
+ block-size: 16px;
+}
+
+.md {
+ --tw-switch-thumb-size: 16px;
+
+ inline-size: 32px;
+ block-size: 20px;
+}
+
+.thumb {
+ position: absolute;
+ inset-block-start: 2px;
+ inset-inline-start: 2px;
+ display: block;
+ inline-size: var(--tw-switch-thumb-size);
+ block-size: var(--tw-switch-thumb-size);
+ border-radius: 50%;
+ corner-shape: round;
+ background-color: var(--t-background-primary);
+ transition: inset-inline-start duration(normal) ease;
+
+ &[data-checked] {
+ inset-inline-start: calc(100% - var(--tw-switch-thumb-size) - 2px);
+ }
+
+ @media (prefers-reduced-motion: reduce) {
+ transition: none;
+ }
+}
diff --git a/packages/twenty-ui/src/input/Toggle/Toggle.module.scss.d.ts b/packages/twenty-ui/src/input/Switch/Switch.module.scss.d.ts
similarity index 55%
rename from packages/twenty-ui/src/input/Toggle/Toggle.module.scss.d.ts
rename to packages/twenty-ui/src/input/Switch/Switch.module.scss.d.ts
index f2dd624e35d..9bc3ca1a4a3 100644
--- a/packages/twenty-ui/src/input/Toggle/Toggle.module.scss.d.ts
+++ b/packages/twenty-ui/src/input/Switch/Switch.module.scss.d.ts
@@ -1,8 +1,7 @@
declare const classNames: {
readonly root: 'root';
- readonly centered: 'centered';
- readonly small: 'small';
- readonly medium: 'medium';
+ readonly sm: 'sm';
+ readonly md: 'md';
readonly thumb: 'thumb';
};
export default classNames;
diff --git a/packages/twenty-ui/src/input/Switch/Switch.tsx b/packages/twenty-ui/src/input/Switch/Switch.tsx
new file mode 100644
index 00000000000..96029e1243d
--- /dev/null
+++ b/packages/twenty-ui/src/input/Switch/Switch.tsx
@@ -0,0 +1,22 @@
+import { Switch as SwitchPrimitive } from '@base-ui/react/switch';
+import { clsx } from 'clsx';
+
+import { mergeClassNames } from '@ui/utilities/internal/mergeClassNames';
+
+import styles from './Switch.module.scss';
+import { type SwitchProps } from './types/SwitchProps';
+
+export const Switch = ({
+ size = 'md',
+ className,
+ children,
+ ...props
+}: SwitchProps) => (
+ <SwitchPrimitive.Root
+ {...props}
+ className={mergeClassNames(clsx(styles.root, styles[size]), className)}
+ >
+ <SwitchPrimitive.Thumb className={styles.thumb} />
+ {children}
+ </SwitchPrimitive.Root>
+);
diff --git a/packages/twenty-ui/src/input/Switch/__stories__/Switch.integrations.stories.tsx b/packages/twenty-ui/src/input/Switch/__stories__/Switch.integrations.stories.tsx
new file mode 100644
index 00000000000..c7f016d6053
--- /dev/null
+++ b/packages/twenty-ui/src/input/Switch/__stories__/Switch.integrations.stories.tsx
@@ -0,0 +1,47 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { useState } from 'react';
+import { expect, fn, userEvent, within } from 'storybook/test';
+
+import { MenuItemSwitch } from '@ui/navigation/MenuItemSwitch/MenuItemSwitch';
+import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';
+
+const meta: Meta<typeof MenuItemSwitch> = {
+ title: 'UI/Input/Switch/Integrations',
+ component: MenuItemSwitch,
+ parameters: { container: { width: 300 }, a11y: A11Y_DEFER_COLOR_CONTRAST },
+};
+
+export default meta;
+type Story = StoryObj<typeof MenuItemSwitch>;
+
+type MenuSwitchProps = { onCheckedChange?: (checked: boolean) => void };
+
+const MenuSwitch = ({ onCheckedChange }: MenuSwitchProps) => {
+ const [checked, setChecked] = useState(false);
+ return (
+ <MenuItemSwitch
+ text="Notifications"
+ checked={checked}
+ onCheckedChange={(nextChecked) => {
+ setChecked(nextChecked);
+ onCheckedChange?.(nextChecked);
+ }}
+ />
+ );
+};
+
+export const MenuItem: Story = {
+ decorators: [ComponentDecorator],
+ args: { onCheckedChange: fn() },
+ render: (args) => <MenuSwitch {...args} />,
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const control = canvas.getByRole('switch', { name: 'Notifications' });
+ await userEvent.click(control);
+ await expect(control).toBeChecked();
+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(1);
+ await userEvent.click(canvas.getByText('Notifications'));
+ await expect(control).not.toBeChecked();
+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(2);
+ },
+};
diff --git a/packages/twenty-ui/src/input/Switch/__stories__/Switch.interactions.stories.tsx b/packages/twenty-ui/src/input/Switch/__stories__/Switch.interactions.stories.tsx
new file mode 100644
index 00000000000..3e5873a5b17
--- /dev/null
+++ b/packages/twenty-ui/src/input/Switch/__stories__/Switch.interactions.stories.tsx
@@ -0,0 +1,231 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { useState } from 'react';
+import { expect, fn, userEvent, waitFor, within } from 'storybook/test';
+
+import { Field } from '@ui/input/Field/Field';
+import { A11Y_DEFER_COLOR_CONTRAST, ComponentDecorator } from '@ui/testing';
+
+import { Switch } from '../Switch';
+import { type SwitchProps } from '../types/SwitchProps';
+
+const meta: Meta<typeof Switch> = {
+ title: 'UI/Input/Switch/Interactions',
+ component: Switch,
+ args: { 'aria-label': 'Notifications' },
+};
+
+export default meta;
+type Story = StoryObj<typeof Switch>;
+
+export const Pointer: Story = {
+ decorators: [ComponentDecorator],
+ args: { onCheckedChange: fn() },
+ play: async ({ canvasElement, args }) => {
+ const control = within(canvasElement).getByRole('switch');
+ await expect(control).not.toBeChecked();
+ await userEvent.click(control);
+ await expect(control).toBeChecked();
+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(1);
+ await expect(args.onCheckedChange).toHaveBeenCalledWith(
+ true,
+ expect.objectContaining({
+ event: expect.objectContaining({ type: 'click' }),
+ }),
+ );
+ await userEvent.click(control);
+ await expect(control).not.toBeChecked();
+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(2);
+ },
+};
+
+export const Keyboard: Story = {
+ decorators: [ComponentDecorator],
+ play: async ({ canvasElement }) => {
+ const control = within(canvasElement).getByRole('switch');
+ await userEvent.tab();
+ await expect(control).toHaveFocus();
+ await userEvent.keyboard(' ');
+ await expect(control).toBeChecked();
+ await userEvent.keyboard(' ');
+ await expect(control).not.toBeChecked();
+ },
+};
+
+const ControlledSwitch = (props: SwitchProps) => {
+ const [checked, setChecked] = useState(false);
+ return (
+ <>
+ <Switch
+ {...props}
+ checked={checked}
+ onCheckedChange={(nextChecked, details) => {
+ props.onCheckedChange?.(nextChecked, details);
+ setChecked(nextChecked);
+ }}
+ />
+ <button onClick={() => setChecked(false)}>Reset notifications</button>
+ </>
+ );
+};
+
+export const Controlled: Story = {
+ ...Pointer,
+ render: (args) => <ControlledSwitch {...args} />,
+ play: async ({ canvasElement, args }) => {
+ const canvas = within(canvasElement);
+ const control = canvas.getByRole('switch');
+ await userEvent.click(control);
+ await expect(control).toBeChecked();
+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(1);
+ await userEvent.click(
+ canvas.getByRole('button', { name: 'Reset notifications' }),
+ );
+ await expect(control).not.toBeChecked();
+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(1);
+ },
+};
+
+export const Disabled: Story = {
+ ...Pointer,
+ args: { disabled: true, onCheckedChange: fn() },
+ play: async ({ canvasElement, args }) => {
+ const control = within(canvasElement).getByRole('switch');
+ await expect(control).toHaveAttribute('aria-disabled', 'true');
+ await userEvent.click(control);
+ await userEvent.tab();
+ await expect(control).not.toHaveFocus();
+ await expect(control).not.toBeChecked();
+ await expect(args.onCheckedChange).not.toHaveBeenCalled();
+ },
+};
+
+export const ReadOnly: Story = {
+ ...Pointer,
+ args: { readOnly: true, defaultChecked: true, onCheckedChange: fn() },
+ play: async ({ canvasElement, args }) => {
+ const control = within(canvasElement).getByRole('switch');
+ await userEvent.click(control);
+ await userEvent.keyboard(' ');
+ await expect(control).toBeChecked();
+ await expect(args.onCheckedChange).not.toHaveBeenCalled();
+ },
+};
+
+export const CanceledChange: Story = {
+ ...Pointer,
+ args: { onCheckedChange: fn((_checked, details) => details.cancel()) },
+ play: async ({ canvasElement, args }) => {
+ const control = within(canvasElement).getByRole('switch');
+ await userEvent.click(control);
+ await expect(args.onCheckedChange).toHaveBeenCalledTimes(1);
+ await expect(control).not.toBeChecked();
+ },
+};
+
+export const NativeButton: Story = {
+ ...Pointer,
+ args: { nativeButton: true, render: <button />, onCheckedChange: fn() },
+};
+
+export const StateCallbacks: Story = {
+ ...Pointer,
+ args: {
+ onCheckedChange: fn(),
+ className: (state) =>
+ state.checked ? 'consumer-checked' : 'consumer-unchecked',
+ style: (state) => ({ marginInlineStart: state.checked ? 8 : 0 }),
+ render: (props, state) => (
+ <span {...props} data-consumer-checked={state.checked} />
+ ),
+ },
+ play: async ({ canvasElement }) => {
+ const control = within(canvasElement).getByRole('switch');
+ await expect(control).toHaveClass('consumer-unchecked');
+ await userEvent.click(control);
+ await expect(control).toHaveClass('consumer-checked');
+ await expect(control).toHaveAttribute('data-consumer-checked', 'true');
+ await expect(control).toHaveStyle({ marginInlineStart: '8px' });
+ await expect(control).toBeChecked();
+ },
+};
+
+const SwitchForm = () => {
+ const [submitted, setSubmitted] = useState('');
+ const [checked, setChecked] = useState(true);
+ return (
+ <form
+ onReset={() => setChecked(true)}
+ onSubmit={(event) => {
+ event.preventDefault();
+ setSubmitted(
+ String(new FormData(event.currentTarget).get('notifications')),
+ );
+ }}
+ >
+ <Field.Root name="notifications">
+ <Field.Label>
+ <Switch
+ checked={checked}
+ onCheckedChange={setChecked}
+ value="enabled"
+ uncheckedValue="disabled"
+ />
+ Notifications
+ </Field.Label>
+ <Field.Description>
+ Receive updates about your workspace.
+ </Field.Description>
+ </Field.Root>
+ <button type="submit">Save</button>
+ <button type="reset">Reset</button>
+ <output aria-label="Submitted value">{submitted}</output>
+ </form>
+ );
+};
+
+export const FormAndField: Story = {
+ parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },
+ decorators: [ComponentDecorator],
+ render: () => <SwitchForm />,
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const control = canvas.getByRole('switch', { name: 'Notifications' });
+ await expect(control).toHaveAccessibleDescription(
+ 'Receive updates about your workspace.',
+ );
+ await userEvent.click(canvas.getByRole('button', { name: 'Save' }));
+ await expect(canvas.getByRole('status')).toHaveTextContent('enabled');
+ await userEvent.click(canvas.getByText('Notifications'));
+ await expect(control).not.toBeChecked();
+ await userEvent.click(canvas.getByRole('button', { name: 'Save' }));
+ await expect(canvas.getByRole('status')).toHaveTextContent('disabled');
+ await userEvent.click(canvas.getByRole('button', { name: 'Reset' }));
+ await waitFor(() => expect(control).toBeChecked());
+ },
+};
+
+export const SiblingLabel: Story = {
+ decorators: [ComponentDecorator],
+ render: () => (
+ <>
+ <label htmlFor="notification-switch">Notifications</label>
+ <Switch id="notification-switch" />
+ </>
+ ),
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ await userEvent.click(canvas.getByText('Notifications'));
+ await expect(
+ canvas.getByRole('switch', { name: 'Notifications' }),
+ ).toBeChecked();
+ },
+};
+
+export const RightToLeft: Story = {
+ ...Pointer,
+ render: (args) => (
+ <div dir="rtl">
+ <Switch {...args} />
+ </div>
+ ),
+};
diff --git a/packages/twenty-ui/src/input/Switch/__stories__/Switch.stories.tsx b/packages/twenty-ui/src/input/Switch/__stories__/Switch.stories.tsx
new file mode 100644
index 00000000000..1c8c4cebad3
--- /dev/null
+++ b/packages/twenty-ui/src/input/Switch/__stories__/Switch.stories.tsx
@@ -0,0 +1,82 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+
+import {
+ A11Y_DEFER_COLOR_CONTRAST,
+ CatalogDecorator,
+ type CatalogStory,
+ ComponentDecorator,
+} from '@ui/testing';
+import { themeCssVariables } from '@ui/theme-constants';
+
+import { Switch } from '../Switch';
+import { type SwitchProps } from '../types/SwitchProps';
+import { type SwitchSize } from '../types/SwitchSize';
+
+const meta: Meta<typeof Switch> = {
+ title: 'UI/Input/Switch/Switch',
+ component: Switch,
+ args: { 'aria-label': 'Notifications' },
+};
+
+export default meta;
+type Story = StoryObj<typeof Switch>;
+
+export const Default: Story = { decorators: [ComponentDecorator] };
+export const Checked: Story = { ...Default, args: { defaultChecked: true } };
+export const Small: Story = {
+ ...Checked,
+ args: { defaultChecked: true, size: 'sm' },
+};
+export const CustomColor: Story = {
+ ...Checked,
+ args: {
+ defaultChecked: true,
+ style: { color: themeCssVariables.color.yellow },
+ },
+};
+export const RightToLeft: Story = {
+ ...Checked,
+ render: (args) => (
+ <div dir="rtl">
+ <Switch {...args} />
+ </div>
+ ),
+};
+
+const STATE_PROPS = {
+ off: {},
+ on: { defaultChecked: true },
+ disabled: { disabled: true },
+ 'disabled on': { disabled: true, defaultChecked: true },
+ 'read only': { readOnly: true, defaultChecked: true },
+ focus: { className: 'focus' },
+} satisfies Record<string, Partial<SwitchProps>>;
+
+export const Catalog: CatalogStory<Story, typeof Switch> = {
+ decorators: [CatalogDecorator],
+ parameters: {
+ a11y: A11Y_DEFER_COLOR_CONTRAST,
+ pseudo: { focusVisible: ['.focus'] },
+ catalog: {
+ dimensions: [
+ {
+ name: 'size',
+ values: ['sm', 'md'] satisfies SwitchSize[],
+ props: (size: SwitchSize) => ({ size }),
+ },
+ {
+ name: 'state',
+ values: Object.keys(STATE_PROPS),
+ props: (state: keyof typeof STATE_PROPS) => STATE_PROPS[state],
+ },
+ ],
+ options: { elementContainer: { style: { width: 120 } } },
+ },
+ },
+};
+
+export const CatalogDark: typeof Catalog = {
+ ...Catalog,
+ tags: ['!autodocs'],
+ globals: { colorScheme: 'dark' },
+};
diff --git a/packages/twenty-ui/src/input/Switch/__tests__/Switch.test.tsx b/packages/twenty-ui/src/input/Switch/__tests__/Switch.test.tsx
new file mode 100644
index 00000000000..b0c9711e41b
--- /dev/null
+++ b/packages/twenty-ui/src/input/Switch/__tests__/Switch.test.tsx
@@ -0,0 +1,11 @@
+import { runComponentConformance } from '@test-utilities/conformance/runComponentConformance';
+
+import { Switch } from '../Switch';
+import styles from '../Switch.module.scss';
+
+runComponentConformance({
+ name: 'Switch',
+ element: <Switch aria-label="Notifications" />,
+ refInstanceOf: HTMLSpanElement,
+ ownClassName: styles.root,
+});
diff --git a/packages/twenty-ui/src/input/Switch/types/SwitchProps.ts b/packages/twenty-ui/src/input/Switch/types/SwitchProps.ts
new file mode 100644
index 00000000000..7a947122a4a
--- /dev/null
+++ b/packages/twenty-ui/src/input/Switch/types/SwitchProps.ts
@@ -0,0 +1,7 @@
+import { type Switch as SwitchPrimitive } from '@base-ui/react/switch';
+
+import { type SwitchSize } from './SwitchSize';
+
+export type SwitchProps = SwitchPrimitive.Root.Props & {
+ size?: SwitchSize;
+};
diff --git a/packages/twenty-ui/src/input/Switch/types/SwitchSize.ts b/packages/twenty-ui/src/input/Switch/types/SwitchSize.ts
new file mode 100644
index 00000000000..4c1733b7bba
--- /dev/null
+++ b/packages/twenty-ui/src/input/Switch/types/SwitchSize.ts
@@ -0,0 +1 @@
+export type SwitchSize = 'sm' | 'md';
diff --git a/packages/twenty-ui/src/input/Toggle/Toggle.module.scss b/packages/twenty-ui/src/input/Toggle/Toggle.module.scss
deleted file mode 100644
index 643572e3af7..00000000000
--- a/packages/twenty-ui/src/input/Toggle/Toggle.module.scss
+++ /dev/null
@@ -1,66 +0,0 @@
-.root {
- position: relative;
- display: flex;
- flex-shrink: 0;
- align-items: center;
- align-self: flex-start;
- border-radius: var(--t-border-radius-pill);
- corner-shape: round;
- background-color: var(--t-background-transparent-medium);
- cursor: pointer;
- transition: background-color duration(normal) ease;
-
- &[data-checked] {
- background-color: var(--toggle-on-color, var(--t-color-blue));
- }
-
- &[data-disabled] {
- opacity: 0.5;
- pointer-events: none;
- }
-}
-
-.centered {
- align-self: center;
-}
-
-.small {
- width: 24px;
- height: 16px;
-}
-
-.medium {
- width: 32px;
- height: 20px;
-}
-
-.thumb {
- position: absolute;
- top: 50%;
- left: 0;
- display: block;
- border-radius: 50%;
- corner-shape: round;
- background-color: var(--t-background-primary);
- transition: transform duration(normal) ease;
-}
-
-.small .thumb {
- width: 12px;
- height: 12px;
- transform: translate(2px, -50%);
-}
-
-.medium .thumb {
- width: 16px;
- height: 16px;
- transform: translate(2px, -50%);
-}
-
-.small[data-checked] .thumb {
- transform: translate(10px, -50%);
-}
-
-.medium[data-checked] .thumb {
- transform: translate(14px, -50%);
-}
diff --git a/packages/twenty-ui/src/input/Toggle/Toggle.tsx b/packages/twenty-ui/src/input/Toggle/Toggle.tsx
deleted file mode 100644
index 7323f78cabf..00000000000
--- a/packages/twenty-ui/src/input/Toggle/Toggle.tsx
+++ /dev/null
@@ -1,54 +0,0 @@
-import { Switch } from '@base-ui/react/switch';
-import { clsx } from 'clsx';
-
-import styles from './Toggle.module.scss';
-
-export type ToggleSize = 'small' | 'medium';
-
-export type ToggleProps = {
- id?: string;
- value?: boolean;
- onChange?: (value: boolean, e?: React.MouseEvent<HTMLDivElement>) => void;
- color?: string;
- toggleSize?: ToggleSize;
- className?: string;
- centered?: boolean;
- disabled?: boolean;
- 'aria-label'?: string;
- 'aria-labelledby'?: string;
-};
-
-export const Toggle = ({
- id,
- value = false,
- onChange,
- color,
- toggleSize = 'medium',
- className,
- centered,
- disabled,
- 'aria-label': ariaLabel,
- 'aria-labelledby': ariaLabelledBy,
-}: ToggleProps) => (
- <Switch.Root
- id={id}
- checked={value}
- disabled={disabled}
- onCheckedChange={(checked) => onChange?.(checked)}
- aria-label={ariaLabel}
- aria-labelledby={ariaLabelledBy}
- className={clsx(
- styles.root,
- styles[toggleSize],
- centered && styles.centered,
- className,
- )}
- style={
- color
- ? ({ '--toggle-on-color': color } as React.CSSProperties)
- : undefined
- }
- >
- <Switch.Thumb className={styles.thumb} />
- </Switch.Root>
-);
diff --git a/packages/twenty-ui/src/input/Toggle/__stories__/Toggle.stories.tsx b/packages/twenty-ui/src/input/Toggle/__stories__/Toggle.stories.tsx
deleted file mode 100644
index daf27e7e83b..00000000000
--- a/packages/twenty-ui/src/input/Toggle/__stories__/Toggle.stories.tsx
+++ /dev/null
@@ -1,101 +0,0 @@
-import { type Meta, type StoryObj } from '@storybook/react-vite';
-import {
- A11Y_DEFER_COLOR_CONTRAST,
- CatalogDecorator,
- type CatalogStory,
- ComponentDecorator,
-} from '@ui/testing';
-import { themeCssVariables } from '@ui/theme-constants';
-import { useState } from 'react';
-
-import { Toggle, type ToggleSize } from '@ui/input/Toggle/Toggle';
-
-type InteractiveToggleProps = {
- initialValue?: boolean;
- toggleSize?: ToggleSize;
- color?: string;
- disabled?: boolean;
-};
-
-const InteractiveToggle = ({
- initialValue = false,
- toggleSize = 'medium',
- color,
- disabled,
-}: InteractiveToggleProps) => {
- const [value, setValue] = useState(initialValue);
-
- return (
- <Toggle
- value={value}
- onChange={setValue}
- toggleSize={toggleSize}
- color={color}
- disabled={disabled}
- aria-label="Toggle"
- />
- );
-};
-
-const meta: Meta<typeof InteractiveToggle> = {
- title: 'UI/Input/Toggle/Toggle',
- component: InteractiveToggle,
-};
-
-export default meta;
-type Story = StoryObj<typeof InteractiveToggle>;
-
-export const Default: Story = {
- args: {
- initialValue: false,
- disabled: false,
- toggleSize: 'medium',
- },
- decorators: [ComponentDecorator],
-};
-
-export const Catalog: CatalogStory<Story, typeof InteractiveToggle> = {
- args: {},
- argTypes: {
- toggleSize: { control: false },
- initialValue: { control: false },
- disabled: { control: false },
- color: { control: false },
- },
- parameters: {
- a11y: A11Y_DEFER_COLOR_CONTRAST,
- catalog: {
- dimensions: [
- {
- name: 'state',
- values: ['disabled', 'off', 'on'],
- props: (state: string) => {
- if (state === 'disabled') {
- return { disabled: true, initialValue: false };
- }
- if (state === 'on') {
- return { initialValue: true };
- }
- return { initialValue: false };
- },
- },
- {
- name: 'size',
- values: ['small', 'medium'] satisfies ToggleSize[],
- props: (toggleSize: ToggleSize) => ({ toggleSize }),
- },
- {
- name: 'color',
- values: ['default', 'custom color'],
- props: (color: string) => {
- if (color === 'default') {
- return {};
- }
- return { color: themeCssVariables.color.yellow };
- },
- },
- ],
- },
- },
- decorators: [CatalogDecorator],
-};
diff --git a/packages/twenty-ui/src/input/index.ts b/packages/twenty-ui/src/input/index.ts
index bcb4abaab16..35c4126e352 100644
--- a/packages/twenty-ui/src/input/index.ts
+++ b/packages/twenty-ui/src/input/index.ts
@@ -7,7 +7,6 @@
* |___/
*/
-export { AdvancedSettingsToggle } from './AdvancedSettingsToggle/AdvancedSettingsToggle';
export type { AnimatedButtonProps } from './AnimatedButton/AnimatedButton';
export { AnimatedButton } from './AnimatedButton/AnimatedButton';
export type { AnimatedLightIconButtonProps } from './AnimatedLightIconButton/AnimatedLightIconButton';
@@ -120,6 +119,9 @@ export type { SelectTriggerProps } from './Select/types/SelectTriggerProps';
export type { SelectValueProps } from './Select/types/SelectValueProps';
export type { SliderColor, SliderProps } from './Slider/Slider';
export { Slider } from './Slider/Slider';
+export { Switch } from './Switch/Switch';
+export type { SwitchProps } from './Switch/types/SwitchProps';
+export type { SwitchSize } from './Switch/types/SwitchSize';
export type { TabContentProps } from './TabButton/TabButton';
export {
StyledTabContainer,
@@ -128,8 +130,6 @@ export {
} from './TabButton/TabButton';
export { Textarea } from './Textarea/Textarea';
export type { TextareaProps } from './Textarea/types/TextareaProps';
-export type { ToggleSize, ToggleProps } from './Toggle/Toggle';
-export { Toggle } from './Toggle/Toggle';
export type { ColorScheme } from './types/ColorScheme';
export type { InputSize } from './types/InputSize';
export type { SelectOption } from './types/SelectOption';
diff --git a/packages/twenty-ui/src/navigation/MenuItemToggle/MenuItemToggle.module.scss b/packages/twenty-ui/src/navigation/MenuItemSwitch/MenuItemSwitch.module.scss
similarity index 85%
rename from packages/twenty-ui/src/navigation/MenuItemToggle/MenuItemToggle.module.scss
rename to packages/twenty-ui/src/navigation/MenuItemSwitch/MenuItemSwitch.module.scss
index d56463b1760..feff91d7b73 100644
--- a/packages/twenty-ui/src/navigation/MenuItemToggle/MenuItemToggle.module.scss
+++ b/packages/twenty-ui/src/navigation/MenuItemSwitch/MenuItemSwitch.module.scss
@@ -1,4 +1,4 @@
-.toggleContainer {
+.switchContainer {
align-items: center;
cursor: pointer;
display: flex;
diff --git a/packages/twenty-ui/src/navigation/MenuItemToggle/MenuItemToggle.module.scss.d.ts b/packages/twenty-ui/src/navigation/MenuItemSwitch/MenuItemSwitch.module.scss.d.ts
similarity index 55%
rename from packages/twenty-ui/src/navigation/MenuItemToggle/MenuItemToggle.module.scss.d.ts
rename to packages/twenty-ui/src/navigation/MenuItemSwitch/MenuItemSwitch.module.scss.d.ts
index 8d31b11da53..7874db198b2 100644
--- a/packages/twenty-ui/src/navigation/MenuItemToggle/MenuItemToggle.module.scss.d.ts
+++ b/packages/twenty-ui/src/navigation/MenuItemSwitch/MenuItemSwitch.module.scss.d.ts
@@ -1,4 +1,4 @@
declare const classNames: {
- readonly toggleContainer: 'toggleContainer';
+ readonly switchContainer: 'switchContainer';
};
export default classNames;
diff --git a/packages/twenty-ui/src/navigation/MenuItemToggle/MenuItemToggle.tsx b/packages/twenty-ui/src/navigation/MenuItemSwitch/MenuItemSwitch.tsx
similarity index 66%
rename from packages/twenty-ui/src/navigation/MenuItemToggle/MenuItemToggle.tsx
rename to packages/twenty-ui/src/navigation/MenuItemSwitch/MenuItemSwitch.tsx
index b505f1d74ea..d0178e45515 100644
--- a/packages/twenty-ui/src/navigation/MenuItemToggle/MenuItemToggle.tsx
+++ b/packages/twenty-ui/src/navigation/MenuItemSwitch/MenuItemSwitch.tsx
@@ -1,39 +1,39 @@
import { type IconComponent } from '@ui/icon';
-import { Toggle, type ToggleSize } from '@ui/input';
+import { Switch, type SwitchSize } from '@ui/input';
import { MenuItemLeftContent } from '@ui/navigation/MenuItem/parts/MenuItemLeftContent';
import {
StyledMenuItemBase,
StyledMenuItemRightContent,
} from '@ui/navigation/MenuItem/parts/StyledMenuItemBase';
-import styles from './MenuItemToggle.module.scss';
+import styles from './MenuItemSwitch.module.scss';
-export type MenuItemToggleProps = {
+export type MenuItemSwitchProps = {
focused?: boolean;
LeftIcon?: IconComponent;
withIconContainer?: boolean;
- toggled: boolean;
+ checked: boolean;
text: string;
className?: string;
- onToggleChange?: (toggled: boolean) => void;
- toggleSize?: ToggleSize;
+ onCheckedChange?: (checked: boolean) => void;
+ size?: SwitchSize;
disabled?: boolean;
};
-export const MenuItemToggle = ({
+export const MenuItemSwitch = ({
focused,
LeftIcon,
withIconContainer = false,
text,
- toggled,
+ checked,
className,
- onToggleChange,
- toggleSize,
+ onCheckedChange,
+ size = 'md',
disabled = false,
-}: MenuItemToggleProps) => {
+}: MenuItemSwitchProps) => {
const handleClick = () => {
if (!disabled) {
- onToggleChange?.(!toggled);
+ onCheckedChange?.(!checked);
}
};
@@ -44,7 +44,7 @@ export const MenuItemToggle = ({
disabled={disabled}
onClick={handleClick}
>
- <div className={styles.toggleContainer}>
+ <div className={styles.switchContainer}>
<MenuItemLeftContent
LeftIcon={LeftIcon}
text={text}
@@ -52,10 +52,10 @@ export const MenuItemToggle = ({
disabled={disabled}
/>
<StyledMenuItemRightContent onClick={(e) => e.stopPropagation()}>
- <Toggle
- value={toggled}
- onChange={disabled ? undefined : onToggleChange}
- toggleSize={toggleSize}
+ <Switch
+ checked={checked}
+ onCheckedChange={disabled ? undefined : onCheckedChange}
+ size={size}
disabled={disabled}
aria-label={text}
/>
diff --git a/packages/twenty-ui/src/navigation/MenuItemToggle/__stories__/MenuItemToggle.stories.tsx b/packages/twenty-ui/src/navigation/MenuItemSwitch/__stories__/MenuItemSwitch.stories.tsx
similarity index 80%
rename from packages/twenty-ui/src/navigation/MenuItemToggle/__stories__/MenuItemToggle.stories.tsx
rename to packages/twenty-ui/src/navigation/MenuItemSwitch/__stories__/MenuItemSwitch.stories.tsx
index 81820c8689e..65d2f340c25 100644
--- a/packages/twenty-ui/src/navigation/MenuItemToggle/__stories__/MenuItemToggle.stories.tsx
+++ b/packages/twenty-ui/src/navigation/MenuItemSwitch/__stories__/MenuItemSwitch.stories.tsx
@@ -9,16 +9,16 @@ import {
type CatalogStory,
ComponentDecorator,
} from '@ui/testing';
-import { MenuItemToggle } from '@ui/navigation/MenuItemToggle/MenuItemToggle';
+import { MenuItemSwitch } from '@ui/navigation/MenuItemSwitch/MenuItemSwitch';
-const meta: Meta<typeof MenuItemToggle> = {
- title: 'UI/Navigation/Menu/MenuItem/MenuItemToggle',
- component: MenuItemToggle,
+const meta: Meta<typeof MenuItemSwitch> = {
+ title: 'UI/Navigation/Menu/MenuItem/MenuItemSwitch',
+ component: MenuItemSwitch,
};
export default meta;
-type Story = StoryObj<typeof MenuItemToggle>;
+type Story = StoryObj<typeof MenuItemSwitch>;
export const Default: Story = {
parameters: { a11y: A11Y_DEFER_COLOR_CONTRAST },
@@ -28,7 +28,7 @@ export const Default: Story = {
decorators: [ComponentDecorator],
};
-export const Catalog: CatalogStory<Story, typeof MenuItemToggle> = {
+export const Catalog: CatalogStory<Story, typeof MenuItemSwitch> = {
args: { LeftIcon: IconBell, text: 'Menu item' },
argTypes: {
className: { control: false },
@@ -57,10 +57,10 @@ export const Catalog: CatalogStory<Story, typeof MenuItemToggle> = {
: 'Without icon container',
},
{
- name: 'toggled',
+ name: 'checked',
values: [true, false],
- props: (toggled: boolean) => ({ toggled }),
- labels: (toggled: boolean) => (toggled ? 'Toggled' : 'Not toggled'),
+ props: (checked: boolean) => ({ checked }),
+ labels: (checked: boolean) => (checked ? 'Checked' : 'Unchecked'),
},
{
name: 'states',
diff --git a/packages/twenty-ui/src/navigation/index.ts b/packages/twenty-ui/src/navigation/index.ts
index a559eeab55a..68be9c29ab0 100644
--- a/packages/twenty-ui/src/navigation/index.ts
+++ b/packages/twenty-ui/src/navigation/index.ts
@@ -52,8 +52,8 @@ export { MenuItemSelectColor } from './MenuItemSelectColor/MenuItemSelectColor';
export { MenuItemSelectTag } from './MenuItemSelectTag/MenuItemSelectTag';
export type { MenuItemSuggestionProps } from './MenuItemSuggestion/MenuItemSuggestion';
export { MenuItemSuggestion } from './MenuItemSuggestion/MenuItemSuggestion';
-export type { MenuItemToggleProps } from './MenuItemToggle/MenuItemToggle';
-export { MenuItemToggle } from './MenuItemToggle/MenuItemToggle';
+export type { MenuItemSwitchProps } from './MenuItemSwitch/MenuItemSwitch';
+export { MenuItemSwitch } from './MenuItemSwitch/MenuItemSwitch';
export type { MenuPickerProps } from './MenuPicker/MenuPicker';
export { MenuPicker } from './MenuPicker/MenuPicker';
export { NavigationBar } from './NavigationBar/NavigationBar';