Skip to content
Kappa
Input Area
@dicehub/kappav0.4.2

Input Area

A multi-line text control with native semantics, Kappa density, and optional Ark UI autoresize.

Keep the summary concise and actionable.

<script setup>
import { ref } from "vue";
import { InputArea } from "@dicehub/kappa/components/input-area";
import { Label } from "@dicehub/kappa/components/label";

const description = ref("");
</script>

<template>
  <Label for="project-description">Project description</Label>
  <InputArea
    id="project-description"
    v-model="description"
    aria-describedby="project-description-help"
    placeholder="Describe the goals and constraints..."
    rows="4"
  />
  <p id="project-description-help">Keep the summary concise and actionable.</p>
</template>

Installation

Input Area is part of the main Kappa package. It composes Ark UI Field.Textarea so Ark owns value updates, field context, attribute forwarding, and automatic resizing.

Barrel

import { InputArea } from "@dicehub/kappa";

Granular

import { InputArea } from "@dicehub/kappa/components/input-area";

Usage

Input Area forwards native textarea attributes, classes, styles, and event listeners. Use v-model for controlled text, and always provide an accessible name.

<script setup>
import { ref } from "vue";
import { InputArea } from "@dicehub/kappa/components/input-area";

const message = ref("");
</script>

<template>
  <InputArea
    v-model="message"
    aria-label="Message"
    placeholder="Write a message..."
    rows="3"
  />
</template>

Composition

Typical part hierarchy
Field.Root (optional)
├── Field.Label
├── InputArea <textarea>
│   ├── native value, attributes, and events
│   └── Ark UI autoresize (optional)
├── Field.HelperText
└── Field.ErrorText

Labels, helper text, and validation messages belong to Kappa Field instead of Input Area. The autoresize prop preservesArk UI Field.Textarea behavior.

Examples

Field Composition

Place Input Area inside Field to connect its label, required state, and helper text.

Record assumptions that affect the result.
<script setup>
import { ref } from "vue";
import { Field } from "@dicehub/kappa/components/field";
import { InputArea } from "@dicehub/kappa/components/input-area";

const notes = ref("");
</script>

<template>
  <Field id="simulation-notes" required>
    <Field.Label>
      Simulation notes
      <Field.RequiredIndicator />
    </Field.Label>
    <InputArea v-model="notes" rows="3" />
    <Field.HelperText>Record assumptions that affect the result.</Field.HelperText>
  </Field>
</template>

Sizes

Use the same four density names as Input while preserving a practical writing area.

xs
sm
base
lg
<script setup>
import { InputArea } from "@dicehub/kappa/components/input-area";
</script>

<template>
  <InputArea size="xs" aria-label="Extra-small notes" value="Compact note" />
  <InputArea size="sm" aria-label="Small notes" value="Small note" />
  <InputArea size="base" aria-label="Base notes" value="Base note" />
  <InputArea size="lg" aria-label="Large notes" value="Large note" />
</template>

Controlled Value

Use v-model when application state owns the current text.

31 characters
<script setup>
import { ref } from "vue";
import { InputArea } from "@dicehub/kappa/components/input-area";
import { Label } from "@dicehub/kappa/components/label";

const notes = ref("Review the boundary conditions.");
</script>

<template>
  <Label for="controlled-notes">Review notes</Label>
  <InputArea id="controlled-notes" v-model="notes" rows="3" />
  <output for="controlled-notes">{{ notes.length }} characters</output>
</template>

Auto Resize

Enable Ark UI measurement to grow with content and disable the manual resize handle.

Add lines to grow the control. Manual resizing is disabled in this mode.

<script setup>
import { ref } from "vue";
import { InputArea } from "@dicehub/kappa/components/input-area";
import { Label } from "@dicehub/kappa/components/label";

const log = ref("Initial residual: 2.1e-05");
</script>

<template>
  <Label for="solver-log">Solver log</Label>
  <InputArea id="solver-log" v-model="log" autoresize rows="2" />
</template>

Form States

Disabled, read-only, and invalid states remain distinct in both themes.

Add at least 20 characters.

<script setup>
import { InputArea } from "@dicehub/kappa/components/input-area";
import { Label } from "@dicehub/kappa/components/label";
</script>

<template>
  <Label for="disabled-notes" data-disabled>Disabled</Label>
  <InputArea id="disabled-notes" disabled value="Editing is unavailable." />

  <Label for="readonly-notes">Read only</Label>
  <InputArea id="readonly-notes" readonly value="Approved for release." />

  <Label for="invalid-notes">Invalid</Label>
  <InputArea
    id="invalid-notes"
    invalid
    aria-describedby="invalid-notes-error"
    value="Too short"
  />
  <p id="invalid-notes-error">Add at least 20 characters.</p>
</template>

Character Limit

Pair native maxlength with a live counter when the limit helps the user.

180 remaining
<script setup>
import { computed, ref } from "vue";
import { InputArea } from "@dicehub/kappa/components/input-area";
import { Label } from "@dicehub/kappa/components/label";

const summary = ref("");
const remaining = computed(() => 180 - summary.value.length);
</script>

<template>
  <Label for="release-summary">Release summary</Label>
  <InputArea id="release-summary" v-model="summary" maxlength="180" rows="3" />
  <output for="release-summary" aria-live="polite">{{ remaining }} remaining</output>
</template>

With Button

Compose a native form and submit action without hiding textarea semantics.

<script setup>
import { ref } from "vue";
import { Button } from "@dicehub/kappa/components/button";
import { InputArea } from "@dicehub/kappa/components/input-area";
import { Label } from "@dicehub/kappa/components/label";

const feedback = ref("");
const send = () => {};
</script>

<template>
  <form @submit.prevent="send">
    <Label for="feedback">Feedback</Label>
    <InputArea id="feedback" v-model="feedback" required rows="3" />
    <Button type="submit">Send feedback</Button>
  </form>
</template>

Right to Left

Logical sizing and padding follow the surrounding text direction.

أضف التفاصيل المهمة للمراجعة.

<script setup>
import { InputArea } from "@dicehub/kappa/components/input-area";
import { Label } from "@dicehub/kappa/components/label";
</script>

<template>
  <div dir="rtl" lang="ar">
    <Label for="arabic-notes">ملاحظات</Label>
    <InputArea
      id="arabic-notes"
      aria-describedby="arabic-notes-help"
      placeholder="اكتب ملاحظاتك..."
      rows="3"
    />
    <p id="arabic-notes-help">أضف التفاصيل المهمة للمراجعة.</p>
  </div>
</template>

Accessibility

  • Use a visible Label, Field.Label, aria-label, or aria-labelledby.
  • Native required, maxlength, disabled, and read-only behavior passes through.
  • The invalid prop adds aria-invalid="true"; connect error text with aria-describedby.
  • Field composition supplies the control id and description relationships through Ark UI context.
  • Focus remains visible, forced colors remain usable, and transitions honor reduced motion.

API Reference

InputArea

PropTypeDefaultDescription
asChildbooleanfalseMerges behavior and styling onto one child element through Ark UI.
autoresizebooleanfalseUses Ark UI automatic height measurement and disables manual resizing.
invalidbooleanfalseSets invalid presentation and aria-invalid=true.
modelValuestring | number—Controlled value used by Vue v-model. Updates emit strings.
size"xs" | "sm" | "base" | "lg""base"Sets padding, radius, text size, and minimum height.
$attrsTextareaHTMLAttributes—Native attributes such as rows, maxlength, required, readonly, and name.

Events

EventPayloadDescription
update:modelValuestringEmitted on native input events for Vue v-model.
input / changeEventNative listeners pass through to the textarea element.

Data Attributes

AttributeValueDescription
data-slot"input-area"Stable root-part selector.
data-size"xs" | "sm" | "base" | "lg"Resolved density.
data-autoresize""Present when Ark autoresize is active.
data-invalid""Present for invalid prop or ARIA state.

Exports

ExportDescription
InputAreaStyled Ark UI textarea control.
InputAreaProps / InputAreaEmits / InputAreaSlotsPublic textarea prop, event, and slot contracts.
InputAreaModelValue / InputAreaSizeControlled-value and density types.
INPUT_AREA_SIZESSupported density values.
INPUT_AREA_DEFAULT_SIZEDefault base density.
isInputAreaSizeSupported-size type guard.
resolveInputAreaSizeSafe size resolver with base fallback.