Basic Usage
Label Position
Control label placement with theposition prop:
Learn more about Mintlify
Enter your email to receive updates about new features and product releases.
Toggle between two states with a sliding switch control.
import { Switch } from "@soft-ui/react/switch"
function Example() {
return <Switch label="Enable notifications" />
}
position prop:
import { Switch } from "@soft-ui/react/switch"
function Example() {
return (
<>
<Switch label="Label on right" position="right" />
<Switch label="Label on left" position="left" />
</>
)
}
import { useState } from "react"
import { Switch } from "@soft-ui/react/switch"
function Example() {
const [enabled, setEnabled] = useState(false)
return (
<Switch
label="Auto-save"
checked={enabled}
onCheckedChange={setEnabled}
/>
)
}
import { Switch } from "@soft-ui/react/switch"
function Example() {
return <Switch aria-label="Toggle feature" />
}
import { Switch } from "@soft-ui/react/switch"
function Example() {
return (
<Switch
label="Disabled switch"
disabled
/>
)
}