Textarea
Das native mehrzeilige Feld im Look des Skins: automatische Höhe zwischen einer minimalen und maximalen Zeilenzahl, ein ungültiger Zustand und ein Zeichenzähler, der ansagt, wie viele Zeichen übrig sind.
Angular: verfügbar Vue: verfügbar React: verfügbar React Native: verfügbar
Verwendung
Grows from two to six rows. Shown on your public profile.
<div class="demo-stack" style="max-width: 28rem">
<div soneField>
<label soneFieldLabel for="demo-message">Message</label>
<textarea soneTextarea id="demo-message" placeholder="Type your message here."></textarea>
</div>
<div soneField>
<label soneFieldLabel for="demo-bio">Bio</label>
<textarea soneTextarea #bioField="soneTextarea" id="demo-bio" autosize minRows="2" maxRows="6"
maxlength="160" [value]="bio()" (input)="bio.set(bioField.element.value)"></textarea>
<sone-textarea-count [for]="bioField" />
<p soneFieldDescription>Grows from two to six rows. Shown on your public profile.</p>
</div>
</div>Import
import {
SoneTextareaCountComponent,
SoneTextareaDirective,
} from "@surface-one/angular/textarea";API-Referenz
SoneTextareaCountComponentKomponente
`<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.
| Name | Typ | Standard |
|---|---|---|
forerforderlichThe 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` |
SoneTextareaDirectiveDirektive
`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`.
| Name | Typ | Standard |
|---|---|---|
autosizeGrow and shrink with the content (the native resize handle goes away). | boolean | false |
minRowsThe fewest rows an autosizing textarea shows. | number | null | null |
maxRowsThe most rows it grows to; it scrolls past them. | number | null | null |
maxlengthThe native `maxlength`; a `sone-textarea-count` counts against it. | number | null | null |
invalidA failed check: `aria-invalid` and the destructive border and ring. | boolean | false |