Clipboard

A handy api to handle calls to navigator.clipboard.writeText .

Copy Text

import { TButton } from "@dija/tohama-components";
import { copyToClipboard } from "@dija/tohama-shared";
import { defineComponent } from "vue";

export default defineComponent({
  setup() {
    const onClick = async () => {
      const response = await copyToClipboard("Hello from Clipboard");

      console.log("Clipboard response:", response);
    };

    return () => (
      <TButton design="flat" onClick={onClick}>
        Click to Copy
      </TButton>
    );
  },
});