menu

Framer

Express your creative ideas through interactive design. Join the community for updates, support, resources, and more.

Channels
Chat
view-forward
# All channels
view-forward
# General
view-forward
# Announcements
view-forward
# Bug Reports
view-forward
# Feature Requests
view-forward
# Learn
view-forward
# Meetups
view-forward
# Resources
view-forward
# Snippets & Tips
view-forward
Team

Ref to access in text content in overrides

August 16, 2019 at 2:43am

Ref to access in text content in overrides

August 16, 2019 at 2:43am
I'm wondering the best approach to use ref to access a DOM element to change its text content in override?

August 16, 2019 at 8:18am
The short answer is: you don’t need ref to change the text. Just assign override to the text layer - and pass the desired text to the “text” prop. If you want to change the color or styling of the passed text you can use this method: https://spectrum.chat/thread/e69decbd-e307-4c76-8e7f-30662662dc98?m=MTU2NTUzMjMyMDA3Nw==
like-fill
1
  • reply
  • like
But if you still want to access the underlying DOM node there is a couple of methods to do so. The simplest solution is using the ref prop which gives you the react element. Then use this method to get the actual dom node: https://reactjs.org/docs/react-dom.html#finddomnode Just don’t forget to import the ReactDOM first
Edited
  • reply
  • like