fluentui
fluentui copied to clipboard
onClick event handler for IconButton not working
i have the following code. Unable to attach onClick event . How do i attach handler to item click ?
<IconButton menuProps={menuProps} iconProps={menuIcon} title="menu" ariaLabel="menu" onClick={openPopup()} -- Doesnt work onMenuClick= {openPopup()} -- Fires when the menu is clicked , not the item />
const menuProps: IContextualMenuProps = {
items: [
{
key: 'link',
text: 'Link',
iconProps: { iconName: 'Link' },
},
{
key: 'deLink',
text: 'De-link',
iconProps: { iconName: 'RemoveLink' },
},
],
onItemClick: { ()=> openPopup() }, -- this also doesnt work
onItemClick: { openPopup() }, -- this also doesnt work
directionalHintFixed: false,
}
const menuProps: IContextualMenuProps = { items: [ { key: 'link', text: 'Link', iconProps: { iconName: 'Link' }, }, { key: 'deLink', text: 'De-link', iconProps: { iconName: 'RemoveLink' }, }, ], onItemClick: props => { openPopup() }, -- this is the syntax.. directionalHintFixed: false, };