/** * Toggle-button icon picker. * * A compact grid of the selectable toggle icons. Reads/writes the icon id at * `header.elements.toggle.icon`; the front-end button renders the matching * inline SVG (see Elements::render_toggle()). */ import { __ } from '@wordpress/i18n'; import { toggleIconFor, DEFAULT_TOGGLE_ICON } from './toggle-icons'; interface IconChoice { id: string; label: string; } interface ToggleIconPickerProps { icons: IconChoice[]; value: string; onChange: ( id: string ) => void; } export default function ToggleIconPicker( { icons, value, onChange, }: ToggleIconPickerProps ) { if ( ! icons.length ) { return null; } const current = value || DEFAULT_TOGGLE_ICON; return (