Example#
Usage#
Use a textarea for answers that run longer than a line: a message, a project brief, notes. It grows with what is typed from four rows to sixteen, then scrolls, and can be dragged taller.
- Rows.
minRows(default 4) andmaxRows(default 16) bound the growth. - Limits. Pair
maxLengthwith aCharacterCountunder the field, so the limit is visible before anyone reaches it. - One line? Use
Input. A textarea for a name or an email invites the wrong answer.
Anatomy#
- BoxThe Input's box and states, sized by its content.
.mk-textarea - Text areaThe native textarea; it resizes vertically.
.mk-textarea-control
Volume#
Reading layer: identical at every volume.
Quiet
Studio
Press
Rave
Content#
- Ask an open question in the label or the hint: "What are you making, and by when?"
- If you need specific details, list them in the hint instead of in the placeholder.
- State any limit in words before it bites: "Up to 2,000 characters".
Do and don't#
Do
What you are making, and by when.
Don't
Accessibility#
- Native textarea semantics; it grows with
field-sizing: contentwhere supported and can be resized vertically. - States and messages work as Input's.
| Keys | What happens |
|---|---|
| Tab | Moves focus into the field |
| Enter | Starts a new line |
The colour pairs it prints, with their contrast on both papers:
| Text | Surface | Role | Bone | Night |
|---|---|---|---|---|
--mk-ink | --mk-paper | body | 16.49:1 · Lc 97.4, passes | 16.21:1 · Lc 96.1, passes |
--mk-ink | --mk-paper | body-ui | 16.49:1 · Lc 97.4, passes | 16.21:1 · Lc 96.1, passes |
--mk-ink | --mk-paper | long | 16.49:1 · Lc 97.4, passes | 16.21:1 · Lc 96.1, passes |
--mk-ink | --mk-paper-sunken | body | 15.20:1 · Lc 92.2, passes | 15.53:1 · Lc 95.7, passes |
--mk-ink | --mk-paper-sunken | body-ui | 15.20:1 · Lc 92.2, passes | 15.53:1 · Lc 95.7, passes |
--mk-ink | --mk-paper-sunken | long | 15.20:1 · Lc 92.2, passes | 15.53:1 · Lc 95.7, passes |
--mk-ink | --mk-paper-plate | body | 18.42:1 · Lc 105.1, passes | 15.02:1 · Lc 95.4, passes |
--mk-ink | --mk-paper-plate | body-ui | 18.42:1 · Lc 105.1, passes | 15.02:1 · Lc 95.4, passes |
--mk-ink | --mk-paper-plate | long | 18.42:1 · Lc 105.1, passes | 15.02:1 · Lc 95.4, passes |
--mk-ink-rule | --mk-paper | ui | 3.27:1 · Lc 56.5, passes | 3.65:1 · Lc 25.6, passes |
--mk-ink-rule | --mk-paper-sunken | ui | 3.01:1 · Lc 51.2, passes | 3.49:1 · Lc 25.2, passes |
--mk-ink-rule | --mk-paper-plate | ui | 3.65:1 · Lc 64.1, passes | 3.38:1 · Lc 24.8, passes |
--mk-on-control-2 | --mk-control | body-ui | 6.59:1 · Lc 82.6, passes | 12.47:1 · Lc 82.8, passes |
Props#
| Prop | Type | Default | Description |
|---|---|---|---|
minRows | number | 4 | Rows shown when empty (default 4). |
maxRows | number | 16 | Rows it grows to before it scrolls (default 16). |
className | string | none | Lands on the box. |
style | CSSProperties | none | Lands on the box. |
Tokens#
System tokens (20)
--mk-border--mk-border-thick--mk-control--mk-control-rule--mk-disabled--mk-dur-hover--mk-ease-out--mk-focus--mk-font-text--mk-on-control--mk-on-control-2--mk-radius-control--mk-rule--mk-surface-sunken--mk-text--mk-text-disabled--mk-type-body-ui-leading--mk-type-body-ui-size--mk-type-body-ui-tracking--mk-type-body-ui-weight
Its own properties (5)
--mk-textarea-hatch--mk-textarea-max-rows--mk-textarea-min-rows--mk-textarea-pad--mk-textarea-pad-block
Changelog#
Arrived in 0.1.0.
- The reading layer's controls, overlays, forms and visitor prefs (P2-T1 to P2-T5): every Button is the comic hit key, with IconButton, Link and Tooltip; Input, Textarea, Select, Checkbox and CheckboxGroup, Radio and RadioGroup, Switch, Slider with the ruler, RulerReadout and SegmentedControl; Dialog, Drawer, NavSheet, Tabs, Disclosure, Faq and faqJsonLd on Base UI 1.9 where the platform falls short; Field, Fieldset, Form with the site's inline validation, ErrorSummary, Callout, Honeypot, FormTimestamp and QuoteForm; PrefsScript under 1 KB, usePref and setPref with cross-tab sync, ThemeToggle and the visitor VolumeDial; VisuallyHidden.