Skip to content
On this page

Radio

js
import Radio from "@/components/Radio";

const Example = () => {
  const [value, setValue] = useState("A");
  const [value2, setValue2] = useState("C");
  const handleChange = (e) => {
    setValue(e.target.value);
  };
  return (
    <div>
      <Radio
        label="Checked"
        name="x"
        value="A"
        checked={value === "A"}
        onChange={handleChange}
      />
      <Radio
        label="UnChecked"
        name="x"
        value="B"
        checked={value === "B"}
        onChange={handleChange}
      />
    </div>
  );
};

COPYRIGHT © 2022 Codeshaper, All rights reserved.