SimpleEditor is a constrained message-editor preset.
It keeps formatting intentionally minimal and supports send workflows out of the box.
import { SimpleEditor } from '@lyfie/luthor';
import '@lyfie/luthor/styles.css';
export function App() {
return (
<SimpleEditor
placeholder="Type a message"
submitOnEnter
allowShiftEnter
outputFormat="md"
onSend={({ text }) => {
console.log(text);
}}
/>
);
}SimpleEditorProps is purpose-built for message input:
formattingOptions: SimpleFormattingOptions (bold, italic, strikethrough)onSend: (payload: SimpleEditorSendPayload) => voidoutputFormat: 'md' (default) | 'json'clearOnSend: true (default) | falseallowEmptySend: false (default) | truesubmitOnEnter: false (default) | trueallowShiftEnter: true (default) | falseshowSendButton: true (default) | falsesendButtonPlacement: 'inside' (default) | 'right'sendButtonContent: ReactNode (default 'Send')sendButtonAriaLabel: string (default 'Send message')sendButtonClassName: stringshowBottomToolbar: true (default) | falsetoolbarButtons: readonly SimpleToolbarButton[]toolbarClassName: stringtoolbarStyle: CSSPropertiesscrollAreaClassName: stringminHeight / maxHeight / minWidth / maxWidthmaxHeight, then internal scrolling.SimpleEditorSendPayloadonSend receives:
format: 'md' | 'json'text: output text in the selected outputFormatmarkdown: markdown representation of current contentjson: JSON representation of current content<SimpleEditor
sendButtonPlacement="right"
submitOnEnter
onSend={({ markdown }) => {
console.log(markdown);
}}
/>