Switch

A component for toggling between two states, typically on and off. It's essentially a checkbox in the form of a switch.

In this guide, you'll learn how to use the Switch component.

Was this example helpful?

Usage#

Code
import { Switch } from "@medusajs/ui"
Code
<Switch />

API Reference#

This component is based on the Radix UI Switch primitive.

PropTypeDefault
size
"small"
|"base"
"base"
Was this helpful?

Examples#

Switch Sizes#

Was this example helpful?

Controlled Switch#

You are not managing inventory

Disabled Switch#

Was this example helpful?
Was this guide helpful?
Ask Anything
Ask any questions about Medusa. Get help with your development.
You can also use the Medusa MCP server in Cursor, VSCode, etc...
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break