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-labelor a visible label. WriteBarIconpresets have default labels (Attach, Send, Done); the count is included in the name. Custom icons needlabel.
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`.
| Prop | Type | Default | Description |
|---|---|---|---|
| after | ReactNode | — | Actions after the field, e.g. a send `WriteBarIcon`. |
| align | TextAlign | "left" | Text alignment. |
| before | ReactNode | — | Actions before the field, e.g. an attach `WriteBarIcon`. |
| className | string | — | |
| inlineAfter | ReactNode | — | Actions inside the field, at its end (emoji, stickers). |
| maxHeight | number | 160 | Max height in px before the content scrolls. |
| onHeightChange | (() => void) | — | Called whenever the auto-growing textarea changes height. |
| shadow | boolean | false | Lift 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`.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | — | |
| count | number | — | Badge number, e.g. attached files. |
| label | string | — | Accessible label. Defaults per mode: "Attach", "Send", "Done". Required with a custom icon. |
| mode | WriteBarIconMode | — | Preset icon and default label. |