Input
Text field with a built-in label, placeholder and validation states. Set `multiline` for a textarea.
<arc-input>Overview
Input wraps a native <input> or <textarea> with a label, placeholder and validation feedback.
The multiline prop swaps the <input> for a <textarea> and keeps every other prop the same. The prefix and suffix slots put icons, unit labels or a clear button inside the field's border.
Inside a Form, each Input's name and value are collected on submit, and required fields are checked before the form submits.
Guidelines
Do
- Give every field a `label` so screen readers announce it
- Use the most specific `type`, such as `email` for email addresses, so phones show the right keyboard
- Use `placeholder` for an example value, not as the label
- Use `multiline` for any field that may need more than one line
- Use the `prefix` slot for a search icon or currency symbol
- Use the `suffix` slot for a unit, a clear button or a status icon
- Mark required fields with `required`
Don't
- Don't use the placeholder as the only label. It disappears once someone types
- Don't set `type` on a multiline input. A textarea ignores it, so `type="password"` would show the text
- Don't disable a field without telling the user why
- Don't restyle the error state with custom CSS. Change the design tokens
- Don't use Input for dates or a fixed set of choices. Use DatePicker or Select
Features
- The `label` renders above the field and is tied to it with a generated `for`/`id` pair
- Types: text, email, tel, url and password
- The multiline textarea resizes vertically
- An empty `required` field is invalid, with the message "Please fill out this field."
- A disabled field can't be edited and its value isn't submitted
Preview
Usage
Its events and state need JavaScript, so use the Web Component or a framework wrapper for those.
<!-- Basic form fields -->
<div style="display:flex; flex-direction:column; width:100%; max-width:400px; gap:16px;">
<arc-input label="Name" name="name" placeholder="Jane Doe" required></arc-input>
<arc-input label="Email" name="email" type="email" placeholder="jane@example.com" required></arc-input>
<arc-input label="Message" name="message" multiline placeholder="How can we help?" required></arc-input>
</div>
<!-- With prefix icon (search) -->
<arc-input label="Search" placeholder="Search...">
<svg slot="prefix" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="20" height="20"><path fill-rule="evenodd" d="M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z" clip-rule="evenodd"/></svg>
</arc-input>import { Input } from '@arclux/arc-ui-react';
export default function Example() {
return (
<>
<div style={{ display: 'flex', flexDirection: 'column', width: '100%', maxWidth: 400, gap: 16 }}>
<Input label="Name" name="name" placeholder="Jane Doe" required />
<Input label="Email" name="email" type="email" placeholder="jane@example.com" required />
<Input label="Message" name="message" multiline placeholder="How can we help?" required />
</div>
{/* With prefix icon */}
<Input label="Search" placeholder="Search...">
<svg slot="prefix" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" width="20" height="20"><path fillRule="evenodd" d="M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z" clipRule="evenodd"/></svg>
</Input>
</>
);
}<script setup>
import { Input } from '@arclux/arc-ui-vue';
</script>
<template>
<div style="display:flex; flex-direction:column; width:100%; max-width:400px; gap:16px;">
<Input label="Name" name="name" placeholder="Jane Doe" required />
<Input label="Email" name="email" type="email" placeholder="jane@example.com" required />
<Input label="Message" name="message" multiline placeholder="How can we help?" required />
</div>
</template><script>
import { Input } from '@arclux/arc-ui-svelte';
</script>
<div style="display:flex; flex-direction:column; width:100%; max-width:400px; gap:16px;">
<Input label="Name" name="name" placeholder="Jane Doe" required />
<Input label="Email" name="email" type="email" placeholder="jane@example.com" required />
<Input label="Message" name="message" multiline placeholder="How can we help?" required />
</div>import { Component } from '@angular/core';
import { Input } from '@arclux/arc-ui-angular';
@Component({
imports: [Input],
template: `
<div style="display:flex; flex-direction:column; width:100%; max-width:400px; gap:16px;">
<arc-input label="Name" name="name" placeholder="Jane Doe" required></arc-input>
<arc-input label="Email" name="email" type="email" placeholder="jane@example.com" required></arc-input>
<arc-input label="Message" name="message" multiline placeholder="How can we help?" required></arc-input>
</div>
`,
})
export class ContactFormComponent {}import { Input } from '@arclux/arc-ui-solid';
export default function Example() {
return (
<div style={{ display: 'flex', 'flex-direction': 'column', width: '100%', 'max-width': '400px', gap: '16px' }}>
<Input label="Name" name="name" placeholder="Jane Doe" required />
<Input label="Email" name="email" type="email" placeholder="jane@example.com" required />
<Input label="Message" name="message" multiline placeholder="How can we help?" required />
</div>
);
}import { Input } from '@arclux/arc-ui-preact';
export default function Example() {
return (
<div style={{ display: 'flex', flexDirection: 'column', width: '100%', maxWidth: 400, gap: 16 }}>
<Input label="Name" name="name" placeholder="Jane Doe" required />
<Input label="Email" name="email" type="email" placeholder="jane@example.com" required />
<Input label="Message" name="message" multiline placeholder="How can we help?" required />
</div>
);
}<div style="display:flex; flex-direction:column; width:100%; max-width:400px; gap:16px;">
<arc-input label="Name" name="name" placeholder="Jane Doe" required></arc-input>
<arc-input label="Email" name="email" type="email" placeholder="jane@example.com" required></arc-input>
<arc-input label="Message" name="message" multiline placeholder="How can we help?" required></arc-input>
</div><!-- Auto-generated by @arclux/prism — do not edit manually -->
<!-- arc-input — self-contained, no external CSS needed -->
<div class="arc-input">
</div>API
autoValidatesbooleanfalse- Runs its own constraint logic and owns the whole validity flag set.
namestring''- The
nameattribute sent with form data on submission. Also used by the Form component to track field state and validation. labelstring''- Visible label rendered above the input. Automatically associated with the field via a generated id, ensuring screen readers announce it correctly.
placeholderstring''- Hint text displayed inside the field when it is empty. Use it to show an example value, never as a substitute for the label.
valuestring''- The current value of the input. Can be set programmatically to pre-fill the field or used for controlled-component patterns. Updated internally on each keystroke.
disabledbooleanfalse- Prevents user interaction and applies a muted visual treatment. The field value is excluded from form submission when disabled.
errorstring''- Error message displayed below the input. When set, the input border turns red and the error text appears.
rowsnumber5- Number of visible text rows when
multilineis true. Controls the initial height of the textarea. Ignored for single-line inputs. type'text' | 'email' | 'tel' | 'url' | 'password''text'- The HTML input type. Controls browser validation behavior and which virtual keyboard appears on mobile devices. Ignored when
multilineis true. multilinebooleanfalse- When true, renders a
<textarea>instead of an<input>, allowing multi-row text entry. The textarea is vertically resizable by default. requiredbooleanfalse- Marks the field as required. Displays a required indicator next to the label and triggers native constraint validation on form submission.
readonlybooleanfalse- Prevents the user from editing the value while keeping the field focusable, and the value is still submitted with the form.
size'sm' | 'md' | 'lg''md'- Controls the input size. Options: 'sm', 'md', 'lg'.
formAssociatedbooleantruepropertiesobject{ // flag(), unlike `disabled`. The exclusion in props.js is specifically // about form-associated *platform* semantics: a `disabled` content // attribute that is merely present makes the element actually disabled // per the HTML spec, and formDisabledCallback assigns the property back, // so no converter can win. Neither of these is platform-mapped: // `required` is enforced by _computeValidity() below and `readonly` by // each component's own interaction handlers, so the stock converter buys // nothing here and costs the usual bug: `required="false"` read as true, // blocking submission of a form the author meant to leave optional. // Finding #48's shape, across all 26 form controls at once. required: flag(false), readonly: flag(false), }- Lit merges static properties up the prototype chain, so every consumer
gets these without declaring them.
requiredparticipates in constraint validation below;readonlyreflects for styling and is enforced by each component's interaction handlers (the mixin can't know which gestures mutate state). formvalidityvalidationMessage
Methods
checkValidity()boolean- Whether the control currently satisfies its constraints, per the native
constraint-validation API. Fires
invalidon the element when it does not, and reports nothing to the user. reportValidity()boolean- As checkValidity(), but also shows the browser's validation message against the control when it fails.
Events
arc-inputdetail:{ value: string }- Fired on each keystroke with { value } detail
arc-changedetail:{ value: string }- Fired on blur when value has changed
See also
- TextareaA multi-line text field with a label, an optional character counter and an error message.
- SelectA dropdown for choosing one option from a list in a form.
- ComboboxA text input that filters a list of options as you type, for picking one value from a long list.
- Number InputA number field with minus and plus buttons that keeps the value between `min` and `max`.
- FormWraps ARC UI inputs in a form that validates them on submit and fires arc-submit with their values.
- FrameworksGuide