datui
Color scheme

Forms

WriteBar

Message composer: an auto-growing textarea with action slots and preset icon buttons.

import { WriteBar, WriteBarIcon } from "datui";

Playground

<WriteBar placeholder="Message" />

Examples

Composer

Send on Enter, newline on Shift+Enter.

    Accessibility

    • The textarea is native; label it with aria-label or a visible label.
    • WriteBarIcon presets have default labels (Attach, Send, Done); the count is included in the name. Custom icons need label.

    API

    WriteBar

    Message composer: an auto-growing textarea with action slots. `ref` points at the textarea. Enter handling is up to you, e.g. send on Enter and insert a newline on Shift+Enter in `onKeyDown`.

    PropTypeDefaultDescription
    afterReactNode—Actions after the field, e.g. a send `WriteBarIcon`.
    alignTextAlign"left"Text alignment.
    beforeReactNode—Actions before the field, e.g. an attach `WriteBarIcon`.
    classNamestring—
    inlineAfterReactNode—Actions inside the field, at its end (emoji, stickers).
    maxHeightnumber160Max height in px before the content scrolls.
    onHeightChange(() => void)—Called whenever the auto-growing textarea changes height.
    shadowbooleanfalseLift the bar with a shadow (when floating over content).
    slotProps{ root?: (HTMLAttributes<HTMLDivElement> & { ref?: Ref<HTMLDivElement>; }); } | undefined—Props for the outer bar.

    WriteBarIcon

    Icon button for WriteBar slots: attach, send (accent), done, or a custom icon via `children`.

    PropTypeDefaultDescription
    classNamestring—
    countnumber—Badge number, e.g. attached files.
    labelstring—Accessible label. Defaults per mode: "Attach", "Send", "Done". Required with a custom icon.
    modeWriteBarIconMode—Preset icon and default label.