Components
Switch
A control that allows the user to toggle between checked and not checked.
example.tsx
Import
tsx
import { AppSwitch } from "@/components/primitives/AppSwitch"API Reference
AppSwitch extends all native <button> HTML attributes.
| Prop | Type | Default | Description |
|---|---|---|---|
| checked | boolean | — | The controlled checked state of the switch. |
| onCheckedChange | (checked: boolean) => void | — | Callback fired when the checked state changes. |
| disabled | boolean | — | Whether the switch is disabled. |
| className | string | — | Additional Tailwind classes merged via cn(). Prefer the wrapper pattern for reusable overrides. |
Source
src/components/primitives/AppSwitch.tsx
"use client"
import { Switch } from "../ui/switch"
type AppSwitchProps = React.ComponentPropsWithoutRef<typeof Switch>
function AppSwitch(props: AppSwitchProps) {
return <Switch {...props} />
}
export { AppSwitch }