initial commit
This commit is contained in:
19
components/ui/switch.jsx
Normal file
19
components/ui/switch.jsx
Normal file
@@ -0,0 +1,19 @@
|
||||
import React from "react";
|
||||
|
||||
export const Switch = ({ checked = false, onChange, className = "" }) => (
|
||||
<label className={`inline-flex items-center cursor-pointer ${className}`}>
|
||||
<input
|
||||
type="checkbox"
|
||||
className="sr-only"
|
||||
checked={checked}
|
||||
onChange={(e) => onChange?.(e.target.checked)}
|
||||
/>
|
||||
<span className="relative w-10 h-5 bg-gray-400 rounded-full transition">
|
||||
<span
|
||||
className={`absolute top-0.5 left-0.5 w-4 h-4 bg-white rounded-full transition-transform ${
|
||||
checked ? "translate-x-5" : ""
|
||||
}`}
|
||||
/>
|
||||
</span>
|
||||
</label>
|
||||
);
|
||||
Reference in New Issue
Block a user