|
@@ -0,0 +1,26 @@
|
|
|
+"""A copy to clipboard component."""
|
|
|
+
|
|
|
+from typing import Set
|
|
|
+
|
|
|
+from pynecone.components import Component
|
|
|
+from pynecone.var import Var
|
|
|
+
|
|
|
+
|
|
|
+class CopyToClipboard(Component):
|
|
|
+ """Component to copy text to clipboard."""
|
|
|
+
|
|
|
+ library = "react-copy-to-clipboard"
|
|
|
+
|
|
|
+ tag = "CopyToClipboard"
|
|
|
+
|
|
|
+ # The text to copy when clicked.
|
|
|
+ text: Var[str]
|
|
|
+
|
|
|
+ @classmethod
|
|
|
+ def get_controlled_triggers(cls) -> Set[str]:
|
|
|
+ """Get the event triggers that pass the component's value to the handler.
|
|
|
+
|
|
|
+ Returns:
|
|
|
+ The controlled event triggers.
|
|
|
+ """
|
|
|
+ return {"on_copy"}
|