0

I am creating a custom block and I want to show a button which the user can edit the text of and I want them to be able to select a page/enter a link. I have this working but using URLInputButton does not give the option to open in a new tab like the default wordpress popover when you highlight some text and then choose to add a hyperlink.

This is what I currently have:

<URLInputButton url={url} onChange={onURLChange} />

I have also played around with a popover but not sure how to put what I want in there. This just does what it says and shows text that says 'Popover is toggled!"

<Button variant="secondary" onClick={toggleVisible}>
     Toggle Popover!
     {isVisible && <Popover>Popover is toggled!</Popover>}
</Button>
0

There's no support for such a setting in URLInputButton/URLInput and those components are deprecated. Try LinkControl. It may be helpful to study its use in the core Button block. That seems similar to what you are building.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.