Skip to content

Instantly share code, notes, and snippets.

View mitul-s's full-sized avatar
‼️

Mitul Shah mitul-s

‼️
View GitHub Profile
@mitul-s
mitul-s / switch.js
Last active March 3, 2024 05:18
React Switch / Toggle / UI Control with Framer Motion
import { motion } from "framer-motion";
type SwitchProps = {
children: React.ReactNode;
};
type ControlProps = {
active: boolean;
onClick: () => void;
children: React.ReactNode;
@mitul-s
mitul-s / radix-button.cljs
Created April 18, 2022 20:10
forward ref for radix dialog
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; RADIX BUTTON ONLY TO BE USED WITH RADIX COMPONENTS / 01/26/22
;; (or anything that may require a forwardRef in the future lol)
;; This is a JavaScript based, so there's some key differences of how it's used
;; ** You need to use :> to call it. As such: [:> radix-button]
;; ** If using Phosphor React for Icons, pass it through without [:>].
;; -- As such: {:left-icon Check}
;; ** Do not pass anything other than a string in children
;; ** Pass {:as-child true} to the Radix Trigger Component
;; Everything else should work as intented ⚡️