Skip to content

The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:

Switch component improvements (#70520)

Maz Ameli18706c24560c
diff --git a/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Next.png b/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Next.png
index 523c67a68a3..7d73a6bdd6d 100644
Binary files a/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Next.png and b/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Next.png differ
diff --git a/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Next_Dark_Theme.png b/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Next_Dark_Theme.png
index 547107a23fd..16d44866e20 100644
Binary files a/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Next_Dark_Theme.png and b/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Next_Dark_Theme.png differ
diff --git a/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Previous.png b/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Previous.png
index 70948b31eef..c309a50e813 100644
Binary files a/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Previous.png and b/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Previous.png differ
diff --git a/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Previous_Dark_Theme.png b/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Previous_Dark_Theme.png
index ef3a92646f3..bc5f16cf495 100644
Binary files a/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Previous_Dark_Theme.png and b/.loki/reference/chrome_laptop_Components_Parameters_DatePicker_Relative_Previous_Dark_Theme.png differ
diff --git a/frontend/src/metabase/ui/components/inputs/Switch/Switch.config.ts b/frontend/src/metabase/ui/components/inputs/Switch/Switch.config.ts
index 6b753f1e26d..8c61a08e014 100644
--- a/frontend/src/metabase/ui/components/inputs/Switch/Switch.config.ts
+++ b/frontend/src/metabase/ui/components/inputs/Switch/Switch.config.ts
@@ -42,8 +42,8 @@ const THUMB_SIZES: Record<string, string> = {
const TRACK_PADDING_TOP: Record<string, string> = {
xs: rem(0),
- sm: rem(2),
- md: rem(0),
+ sm: rem(1),
+ md: rem(1),
};
export const switchOverrides = {
diff --git a/frontend/src/metabase/ui/components/inputs/Switch/Switch.mdx b/frontend/src/metabase/ui/components/inputs/Switch/Switch.mdx
index 54abf6ad61f..a7ced776318 100644
--- a/frontend/src/metabase/ui/components/inputs/Switch/Switch.mdx
+++ b/frontend/src/metabase/ui/components/inputs/Switch/Switch.mdx
@@ -20,7 +20,7 @@ Use Switch when you have a setting that can be only either on or off, or enabled
## Usage guidelines
-In most situations you should use the `md` size variant, with the label on the left and the toggle on the right. (This allows users to read what the setting or option is first.)
+In most situations you should use the `sm` size variant, with the label on the left and the toggle on the right. (This allows users to read what the setting or option is first.)
## Examples
diff --git a/frontend/src/metabase/ui/components/inputs/Switch/Switch.module.css b/frontend/src/metabase/ui/components/inputs/Switch/Switch.module.css
index 8b446bd19f6..85d31953fdf 100644
--- a/frontend/src/metabase/ui/components/inputs/Switch/Switch.module.css
+++ b/frontend/src/metabase/ui/components/inputs/Switch/Switch.module.css
@@ -23,7 +23,7 @@
.body {
display: flex;
- align-items: center;
+ align-items: flex-start;
}
&[data-variant="stretch"] {
@@ -60,7 +60,7 @@
.description {
padding: 0;
- margin-top: 0.5rem;
+ margin-top: 0.25rem;
font-size: 0.75rem;
color: var(--mb-color-text-secondary);
line-height: 1rem;