copytoclipboard.py 593 B

1234567891011121314151617181920212223242526
  1. """A copy to clipboard component."""
  2. from typing import Set
  3. from pynecone.components import Component
  4. from pynecone.var import Var
  5. class CopyToClipboard(Component):
  6. """Component to copy text to clipboard."""
  7. library = "react-copy-to-clipboard"
  8. tag = "CopyToClipboard"
  9. # The text to copy when clicked.
  10. text: Var[str]
  11. @classmethod
  12. def get_controlled_triggers(cls) -> Set[str]:
  13. """Get the event triggers that pass the component's value to the handler.
  14. Returns:
  15. The controlled event triggers.
  16. """
  17. return {"on_copy"}