27 lines
594 B
Python
27 lines
594 B
Python
"""A copy to clipboard component."""
|
|
|
|
from typing import Set
|
|
|
|
from pynecone.components import Component
|
|
from pynecone.vars 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"}
|