Skip to content

Instantly share code, notes, and snippets.

@marshallmurphy
Created May 3, 2020 22:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marshallmurphy/f5844e3e9f108c5a564d9aee5d9c98e8 to your computer and use it in GitHub Desktop.
Save marshallmurphy/f5844e3e9f108c5a564d9aee5d9c98e8 to your computer and use it in GitHub Desktop.
import React, { useState } from 'react';
import styles from './toggleRow.module.css';
const ToggleRow = ({ option }) => {
const [active, setActive] = useState(false);
return (
<div className={styles.toggleRow}>
{option}
<label className={styles.toggle}>
<input className={styles.toggleInput} type='checkbox' checked={active} onChange={() => setActive(!active)}/>
<span className={styles.toggleSlider}></span>
</label>
</div>
)
}
export default ToggleRow;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment