charting-library-tutorial icon indicating copy to clipboard operation
charting-library-tutorial copied to clipboard

How to add Icon to Dropdown and dropdown items

Open walrusix opened this issue 3 months ago • 1 comments

Hello, How can i add Icon to Dropdown widget and dropdown items #153

walrusix avatar Nov 26 '25 08:11 walrusix

for dropdown nutton we can use icon as the official example :

widget.createDropdown( { title: 'dropdown', tooltip: 'tooltip for this dropdown', items: [ { title: 'item#1', onSelect: () => {console.log('1');}, }, { title: 'item#2', onSelect: () => {widget.setSymbol('IBM', '1D');}, }, { title: 'item#3', onSelect: () => { widget.activeChart().createStudy( 'MACD', false, false, { in_0: 14, in_1: 30, in_3: 'close', in_2: 9 } ); }, } ], icon: <svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><g fill="none" stroke="currentColor"><circle cx="10" cy="10" r="2.5"/><circle cx="18" cy="18" r="2.5"/><path stroke-linecap="square" d="M17.5 7.5l-7 13"/></g></svg>, } ).then(myDropdownApi => { // Use myDropdownApi if you need to update the dropdown: // myDropdownApi.applyOptions({ // title: 'a new title!' // });

// Or remove the dropdown:
// myDropdownApi.remove();

});

walrusix avatar Nov 26 '25 10:11 walrusix