🎨
UI Knihovna
Kolekce nádherných, znovupoužitelných React komponent a CSS fragmentů vytvořená pomocí Tailwind CSS a Framer Motion.
Přepínače
Interaktivní přepínače pro binární stavy (zapnuto/vypnuto).
Základní přepínač
Toggle.tsxLanguage: tsx
import { useState } from 'react';
import { motion } from 'framer-motion';
export function BasicToggle() {
const [isOn, setIsOn] = useState(false);
return (
<button
onClick={() => setIsOn(!isOn)}
className={`relative inline-flex h-7 w-12 items-center rounded-full transition-colors duration-300 ${
isOn ? 'bg-accent' : 'bg-surface border border-border'
}`}
>
<span className="sr-only">Toggle</span>
<motion.span
layout
className={`inline-block h-5 w-5 rounded-full bg-white shadow-md transform transition-transform ${
isOn ? 'translate-x-6' : 'translate-x-1'
}`}
/>
</button>
);
}Přepínač s ikonami
Toggle.tsxLanguage: tsx
import { useState } from 'react';
import { motion } from 'framer-motion';
export function IconToggle() {
const [isOn, setIsOn] = useState(true);
return (
<button
onClick={() => setIsOn(!isOn)}
className={`relative inline-flex h-8 w-14 items-center rounded-full transition-colors duration-300 ${
isOn ? 'bg-green-500' : 'bg-surface border border-border'
}`}
>
<span className="sr-only">Enable notifications</span>
{/* Background Icons */}
<span className="absolute left-2 text-xs text-white opacity-100 transition-opacity">
✓
</span>
<span className="absolute right-2 text-xs text-muted opacity-100 transition-opacity">
✕
</span>
<motion.span
layout
className={`relative inline-flex h-6 w-6 items-center justify-center rounded-full bg-white shadow-md transform transition-transform ${
isOn ? 'translate-x-[calc(100%+8px)]' : 'translate-x-1'
}`}
>
<span className={`text-[10px] font-bold ${isOn ? 'text-green-500' : 'text-muted'}`}>
{isOn ? 'ON' : 'OFF'}
</span>
</motion.span>
</button>
);
}