| 
 | 1 | +"use client";  | 
 | 2 | +import React, { useState } from "react";  | 
 | 3 | +import RadioSm from "../../form/input/RadioSm";  | 
 | 4 | + | 
 | 5 | +export default function ListWithRadio() {  | 
 | 6 | +  const [selectedValue, setSelectedValue] = useState<string>("option1");  | 
 | 7 | + | 
 | 8 | +  const handleChange = (value: string) => {  | 
 | 9 | +    setSelectedValue(value);  | 
 | 10 | +    console.log("Selected Value:", value);  | 
 | 11 | +  };  | 
 | 12 | +  return (  | 
 | 13 | +    <div className="rounded-lg border border-gray-200 bg-white dark:border-gray-800 dark:bg-white/[0.03] sm:w-fit">  | 
 | 14 | +      <ul className="flex flex-col">  | 
 | 15 | +        <li className="border-b border-gray-200 px-3 py-2.5 last:border-b-0 dark:border-gray-800">  | 
 | 16 | +          <RadioSm  | 
 | 17 | +            id="option1"  | 
 | 18 | +            name="example"  | 
 | 19 | +            value="option1"  | 
 | 20 | +            checked={selectedValue === "option1"}  | 
 | 21 | +            label="Lorem ipsum dolor sit amet"  | 
 | 22 | +            onChange={handleChange}  | 
 | 23 | +          />  | 
 | 24 | +        </li>  | 
 | 25 | +        <li className="border-b border-gray-200 px-3 py-2.5 last:border-b-0 dark:border-gray-800">  | 
 | 26 | +          <RadioSm  | 
 | 27 | +            id="option2"  | 
 | 28 | +            name="example"  | 
 | 29 | +            value="option2"  | 
 | 30 | +            checked={selectedValue === "option2"}  | 
 | 31 | +            label="It is a long established fact reader"  | 
 | 32 | +            onChange={handleChange}  | 
 | 33 | +          />  | 
 | 34 | +        </li>  | 
 | 35 | +        <li className="border-b border-gray-200 px-3 py-2.5 last:border-b-0 dark:border-gray-800">  | 
 | 36 | +          <RadioSm  | 
 | 37 | +            id="option3"  | 
 | 38 | +            name="example"  | 
 | 39 | +            value="option3"  | 
 | 40 | +            checked={selectedValue === "option3"}  | 
 | 41 | +            label="Lorem ipsum dolor sit amet"  | 
 | 42 | +            onChange={handleChange}  | 
 | 43 | +          />  | 
 | 44 | +        </li>  | 
 | 45 | +        <li className="border-b border-gray-200 px-3 py-2.5 last:border-b-0 dark:border-gray-800">  | 
 | 46 | +          <RadioSm  | 
 | 47 | +            id="option4"  | 
 | 48 | +            name="example"  | 
 | 49 | +            value="option4"  | 
 | 50 | +            checked={selectedValue === "option4"}  | 
 | 51 | +            label="Lorem ipsum dolor sit amet"  | 
 | 52 | +            onChange={handleChange}  | 
 | 53 | +          />  | 
 | 54 | +        </li>  | 
 | 55 | +        <li className="border-b border-gray-200 px-3 py-2.5 last:border-b-0 dark:border-gray-800">  | 
 | 56 | +          <RadioSm  | 
 | 57 | +            id="option5"  | 
 | 58 | +            name="example"  | 
 | 59 | +            value="option5"  | 
 | 60 | +            checked={selectedValue === "option5"}  | 
 | 61 | +            label="Lorem ipsum dolor sit amet"  | 
 | 62 | +            onChange={handleChange}  | 
 | 63 | +          />  | 
 | 64 | +        </li>  | 
 | 65 | +      </ul>  | 
 | 66 | +    </div>  | 
 | 67 | +  );  | 
 | 68 | +}  | 
0 commit comments