Get cursor position in text edit

Hi, I'd love to be able to get the cursor position in the text (integer number of characters from the beginning) when editing a text box!

I'd like to insert text into the text at the cursor point when the user clicks a button or such like. Therefore I would like to know the current position in the text as the focus leaves the text box and then insert the relevant text at that position?

Any ideas, or should I move this to feature request?



Hi @jclutterbuck Thanks for sharing! I'm not aware of any workarounds, but we do have a feature request for this internally. I'll post here with any updates on that request

Hi @jclutterbuck,

We were able to launch this sort of feature for the rich text editor:

Does this type of implementation seem like it would be helpful for your use case? It sounds like you'd want to see this for other components. but I wanted to check in about this iteration & also see if it could be a potential workaround

Thanks @Tess,

Ideally I'd like to see this feature in the TextArea component, but, yes, great to see this feature here and I may be able to use it.



1 Like

Any update on this? I'm trying to do the following:
Have a textarea where the user constructs a template.
I want the user to be able to insert template variables with button clicks (or drag and drop, doesn't matter).
Getting the cursor position seems to be all I'd need to achieve this.

Thanks for checking in! We haven't been able to pick this up for the text area yet :disappointed:

I'll follow up here if our team picks this up, but it doesn't look like it's on our near term roadmap