Components

PasteButton

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

Example

Requires React 18.2+ or 19 and shared styles. See setup.

Default

Loading preview…

Code
'use client';
import { useState } from 'react';
import { Text } from '@swiftuijs/ui';
import { VStack } from '@swiftuijs/ui';
import { PasteButton } from '@swiftuijs/ui';
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>);
}
export default function Example() {
    return (<DemoPasteButton />);
}

API reference

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

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