Why does Polaris not offer a toggle button?

Given that Polaris is required/recommended in BFS, why isn’t there a dedicated board in this community?

When I try to migrate from Tailwind to Polaris, I don’t find an equivalent toggle button in Polaris. But I can find it in the Shopify admin => Settings => Customer accounts. How can I use this component?

1 Like

There’s not an official Polaris component for every one you see in the Shopify admin but @devwithalex created https://www.polariscomponents.com/ which includes some additional ones, including a knob/toggle component

5 Likes

Thanks for your components. But I use Vue & Polaris Vue. I don’t use React.

In that case, you’ll have to recreate it on your own. You can use the Knob Polaris Component as a base/reference

Rough demo, based on the react one (this is very rough, please don’t use as-is)

1 Like

Not sure what happened as I thought there was one but it ended up unresolved in discussions and pull requests?

The primitives should all be there though, see the depreciated example for the setting-toggle UI

And the toggle icons:
https://polaris.shopify.com/icons?q=toggle

See anything about dark-mode toggles in shopify|polaris for the patterns as that may lead somewhere though only one I know of is in restyle

When I apply for BFS, the tester requires me to use a contextual save bar but not an auto-save when the button is toggled. I use a toggle button on the settings page. There is no other options required saving on the page. Why is it so stupid?

Now: 1 click to save when the button is toggled
BFS: 1 click to toggle and 1 click to hit the save bar button

The comment:

Form inputs should be saved using the App Bridge Contextual Save Bar API. This also applies to forms within max modals. Continuous data validation or auto-save for forms is incongruous with the standard Shopify admin save UX. See this screenshot and our App Design Guidelines for details. The new App Bridge version must be implemented on all pages with a save or auto-save. Once implemented remove any save buttons as they will become redundant. Ensure to update this throughout the entire app.