OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
import AnimateHeight from '../animate-height';
import { Label } from './label';
import { Switch } from './switch';
type Props = {
active: boolean;
onActiveChange: (newValue: boolean) => void;
label: string;
children: React.ReactNode;
};
export function InputWithToggle({
active,
onActiveChange,
label,
children,
}: Props) {
return (
<div className="col gap-2">
<div className="flex items-center justify-between gap-2">
<Label className="mb-0">{label}</Label>
<Switch checked={active} onCheckedChange={onActiveChange} />
</div>
<AnimateHeight open={active}>{children}</AnimateHeight>
</div>
);
}