import React, { useState } from 'react'; export interface PickerOption { value: string; label: string; description: string; } interface InteractivePickerProps { options: PickerOption[]; defaultValue?: string; renderPreview: (activeValue: string) => React.ReactNode; } export default function InteractivePicker({ options, defaultValue, renderPreview, }: InteractivePickerProps) { const [active, setActive] = useState(defaultValue || options[0]?.value || ''); const activeOption = options.find(o => o.value === active); return (
{options.map(o => ( ))}
{renderPreview(active)}

{active} {' — '} {activeOption?.description}

); }