/** * Segmented control — a labelled row of mutually-exclusive option buttons. * Shared by the row, column, element and off-canvas settings windows. An * option may carry an icon, shown before (or, with an empty label, instead * of) its text. */ import { Button } from '@wordpress/components'; import type { LucideIcon } from '../../icons'; interface SegmentedOption< T > { value: T; label: string; icon?: LucideIcon; } interface SegmentedProps< T extends string > { label: string; value: T; options: SegmentedOption< T >[]; onChange: ( value: T ) => void; } export default function Segmented< T extends string >( { label, value, options, onChange, }: SegmentedProps< T > ) { return (
{ label }
{ options.map( ( opt ) => { const Icon = opt.icon; return ( ); } ) }
); }