Textarea

スキンの見た目をまとうネイティブの複数行フィールド。最小と最大の行数の間で高さを自動調整し、無効状態と、残り文字数を読み上げる文字数カウンターを備えます。

対応フレームワーク
  • Angular: 対応
  • Vue: 対応
  • React: 対応
  • React Native: 対応

使い方

Grows from two to six rows. Shown on your public profile.

インポート

ts
import {
  SoneTextareaCountComponent,
  SoneTextareaDirective,
} from "@surface-one/angular/textarea";

API リファレンス

SoneTextareaCountComponentコンポーネント

`<sone-textarea-count [for]="ta">` — the character counter of a `soneTextarea` (`#ta="soneTextarea"`): `12/200` against its `maxlength` (or the bare count), tinted as the limit nears. A polite live region says how many characters are left once few are, rather than on every keystroke.

セレクター
sone-textarea-count
入力
名前型 デフォルト
for必須

The textarea to count (`#ta="soneTextarea"`).

SoneTextareaDirective—
remainingLabel

"N characters left", read once few are left.

(remaining: number) => string(remaining) => remaining === 1 ? $localize`:A textarea counter, one character left:1 character left` : $localize`:A textarea counter, characters left:${remaining}:count: characters left`

SoneTextareaDirectiveディレクティブ

`textarea[soneTextarea]` — the native multi-line field (spartan/ui `hlmTextarea`, shadcn/ui Textarea) in the skin's `--textarea-*` look, which every `<textarea>` already has; the directive adds `autosize` (the height follows the content between `minRows` and `maxRows`), the `invalid` state and the character count a `sone-textarea-count` shows. Inside a `[soneField]` the field wires `aria-describedby` and `aria-invalid`.

セレクター
textarea[soneTextarea]
エクスポート名
soneTextarea
入力
名前型 デフォルト
autosize

Grow and shrink with the content (the native resize handle goes away).

booleanfalse
minRows

The fewest rows an autosizing textarea shows.

number | nullnull
maxRows

The most rows it grows to; it scrolls past them.

number | nullnull
maxlength

The native `maxlength`; a `sone-textarea-count` counts against it.

number | nullnull
invalid

A failed check: `aria-invalid` and the destructive border and ring.

booleanfalse