Commit Graph
2 Commits
Author SHA1 Message Date
anthony lio 3b12d2e167 feat(ui): switch component (#53379)
## Problem

* the shared switch in `packages/ui` uses the radix primitive
* the thumb does not react to hover or press, and only the track color
shows the state
* a click on a switch label toggles the switch, but the label keeps the
default cursor

## Solution

* replaces the radix switch with base ui, and keeps a native `<button>`,
so labels and `role="switch"` work as before
* changes the thumb to white and the resting track one step darker, so
the off state shows on light pages
* replaces the hover color change with a thumb stretch that grows more
on press, so the thumb reacts to the pointer
* adds a pointer cursor on labels next to an enabled switch, because a
click on the label toggles it
* removes the `PointerEvent` stand-in from the studio test setup,
because it blocks base ui switch clicks in jsdom
* changes the install step in the switch docs to `@base-ui/react`, so
the manual install matches the component

<!-- linear:table-colwidths:345,344 -->
<table>
<thead>
<tr>
<th></th>
<th>preview</th>
</tr>
</thead>
<tbody>
<tr>
<td>light</td>
<td>


https://github.com/user-attachments/assets/a7c33dda-3487-43b8-881b-344e28891650

</td>
</tr>
<tr>
<td>dark</td>
<td>


https://github.com/user-attachments/assets/9718057b-f983-4099-8f7e-82521001b625

</td>
</tr>
</tbody>
</table>

## Preview links

| Site | Live | Preview | Search for |
| -- | -- | -- | -- |
| Design system |
[/design-system/docs/components/switch](<https://supabase.com/design-system/docs/components/switch>)
|
[/design-system/docs/components/switch](<https://design-system-git-feat-switch-base-ui-supabase.vercel.app/design-system/docs/components/switch>)
| Airplane Mode |
| Studio |
[/dashboard/project/\_/storage/files](<https://supabase.com/dashboard/project/_/storage/files>)
|
[/dashboard/project/\_/storage/files](<https://studio-git-feat-switch-base-ui-supabase.vercel.app/dashboard/project/_/storage/files>)
| Public bucket |

## Review instructions

1. open
[/design-system/docs/components/switch](<https://supabase.com/design-system/docs/components/switch>)
and
[/design-system/docs/components/switch](<https://design-system-git-feat-switch-base-ui-supabase.vercel.app/design-system/docs/components/switch>)
side by side
2. hover and click the "airplane mode" label, and make sure that the
cursor is a pointer and the switch toggles
3. change the theme to light and to dark, and make sure that the thumb
stays white in the on and off states
4. scroll to the form example, and make sure that the disabled "security
emails" switch does not toggle or stretch
5. open
[/dashboard/project/\_/storage/files](<https://studio-git-feat-switch-base-ui-supabase.vercel.app/dashboard/project/_/storage/files>),
click "new bucket" and turn on "public bucket", and make sure that the
"public buckets are not protected" warning shows

## Checklist

Check all before review:

- [X] I have read
[CONTRIBUTING.md](<https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md>)
- [X] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](<https://github.com/supabase/supabase/tree/master/apps/docs/style-guide>)
2026-11-19 21:32:09 +00:00
Ivan Vasilov 0abe792889 chore: Migrate the main Tailwind JS config to CSS (#45686)
This PR migrates the JS config for Tailwind into a CSS config. As such,
all variables have been defined as CSS variables and they're using the
specialized Tailwind syntax for generating utility classes.

Beside the migration, these changes were also added:
- Added `tailwind.config.css` to few packages to make the Tailwind
Intellisense work.
- Migrated away from Radix style color classes to our defined classes,
the values will remain the same.
- Most of the CSS is generated by scripts, they'll be removed in next
PRs.
* Removed redundant `border-light` classes from several components since
it was undefined.
* Removed redundant `text-strong` classes from several components since
it was undefined.

How to test:
- Open all apps, compare the UI (mainly colors) to builds from #45417
and try to find a difference.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Style**
* Harmonized color variable usages and updated UI color references
(affects palettes, charts, gradients, hero illustrations, and
scrollbars).
  * Tweaked border, tab, and selection visuals across components.

* **New Features**
* Added a suite of theme animations and refined typography presets used
by site prose and docs.

* **Refactor**
* Overhauled Tailwind/theme configuration and color token generation for
more consistent theming.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-05-13 13:14:58 +02:00