SwiftUI.js
Components

PasteButton

PasteButton reads plain text from the clipboard and forwards it to your app, aligned with SwiftUI's clipboard action model.

PasteButton reads plain text from the clipboard and forwards it to your app, aligned with SwiftUI's clipboard action model.

Examples

Default

Preview unavailable for this example in the static docs build.

Show code
function DemoPasteButton() {
  const [value, setValue] = useState('Nothing pasted yet')

  return (
    <VStack spacing={12}>
      <PasteButton onPaste={(text) => setValue(text)}>Paste text</PasteButton>
      <Text>{value}</Text>
    </VStack>
  )
}

API

PropTypeRequiredDescription
onPaste(value: string) => void | Promise<void>YesCalled with the pasted plain-text content.

Inherits additional props from Omit<IBaseElementComponent<'button'>, 'type' | 'onPaste'>.

Overview

PasteButton reads plain text from the clipboard and forwards it to your app, aligned with SwiftUI's clipboard action model.

On this page