collaborative-ui
Version:
React component library for building real-time collaborative editing applications.
48 lines (47 loc) • 2.23 kB
TypeScript
import * as React from 'react';
import type { CollaborativeStr } from 'collaborative-editor';
export interface CollaborativeFlexibleInputProps {
/** JSON CRDT "str" node API. */
str: () => CollaborativeStr;
/**
* Whether to poll for updates the underlying <input> or <textarea> element
* in case some third-party code modifies the value of the input element.
*/
polling?: boolean;
/** Ref to the input element. */
inp?: (el: HTMLInputElement | HTMLTextAreaElement | null) => void;
/** Whether the input is multiline. */
multiline?: boolean;
/** Whether to wrap text to a new line when it exceeds the length of current. */
wrap?: boolean;
/**
* Whether the input should take the full width of the parent, even when there
* is not enough text to do that naturally with content.
*/
fullWidth?: boolean;
/** Placeholder to display. */
typebefore?: string;
/** Typeahead string to add to the value. It is visible at half opacity. */
typeahead?: string;
/** Addition width to add, for example, to account for number stepper. */
extraWidth?: number;
/** Minimum width to allow. */
minWidth?: number;
/** Maximum width to allow. */
maxWidth?: number;
/** Whether the input is focused on initial render. */
focus?: boolean;
/** Callback for when the input is focused. */
onFocus?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
/** Callback for when the input is blurred. */
onBlur?: React.FocusEventHandler<HTMLInputElement | HTMLTextAreaElement>;
/** Callback for when a key is pressed. */
onKeyDown?: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
/** Callback for when the Enter key is pressed. */
onSubmit?: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
/** Callback for when the Escape key is pressed. */
onCancel?: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
/** Callback for when the Tab key is pressed. */
onTab?: React.KeyboardEventHandler<HTMLInputElement | HTMLTextAreaElement>;
}
export declare const CollaborativeFlexibleInput: React.FC<CollaborativeFlexibleInputProps>;