Skip to content
Porcelana

Field, Input & Textarea

Labelled text inputs with descriptions and errors wired up for screen readers.

Inputs

Example

Shown on the lock screen

Example.tsx
import { Field, Input, Textarea } from "@porcelana/ui";
import { SearchIcon } from "@porcelana/icons";

export default function Example() {
  return (
    <div style={{ display: "grid", gap: 16, maxWidth: 420 }}>
      <Field label="Alarm label" description="Shown on the lock screen" required>
        <Input defaultValue="Morning run" />
      </Field>
      <Field label="Notify email" error="Enter a complete email address">
        <Input type="email" defaultValue="pierre@" />
      </Field>
      <Field label="Note">
        <Textarea placeholder="Anything to remember at 06:00?" />
      </Field>
      <Input aria-label="Search" placeholder="Search" icon={<SearchIcon size={18} />} />
    </div>
  );
}

Import

Import
import { Field, Input, Textarea, Label } from "@porcelana/ui";
import "@porcelana/ui/styles.css"; // once, at your app root

Props

Generated from the TypeScript types. Standard HTML attributes are passed through and not listed.

Field

PropTypeDefaultDescription
childrenrequiredReactElement<Record<string, unknown>, string | JSXElementConstructor<any>>–A single control element (Input, Textarea, Select trigger…).
labelrequiredReactNode–Visible label, linked to the control.
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
descriptionReactNode–Help text under the control; added to aria-describedby.
disabledboolean–Prevents interaction and dims the control.
errorReactNode–Error message. Sets aria-invalid on the control and is announced.
idstring–Overrides the generated id passed to the control.
requiredboolean–Marks the control as required in forms.

Input

PropTypeDefaultDescription
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
disabledboolean–Prevents interaction and dims the control.
iconReactNode–Leading icon, e.g. a search glyph. Decorative.
idstring–Element id. Generated automatically when omitted.
invalidboolean–Error styling and aria-invalid. Field sets this for you when it has an error.
placeholderstring–Hint shown when there is no value.
requiredboolean–Marks the control as required in forms.
type"button" | "submit" | "reset"–Button type (defaults to "button").

Textarea

PropTypeDefaultDescription
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
disabledboolean–Prevents interaction and dims the control.
idstring–Element id. Generated automatically when omitted.
invalidboolean–Error styling and aria-invalid. Field sets this for you when it has an error.
placeholderstring–Hint shown when there is no value.
requiredboolean–Marks the control as required in forms.

Label

PropTypeDefaultDescription
aria-labelstring–Defines a string value that labels the current element. @see aria-labelledby.
idstring–Element id. Generated automatically when omitted.

Accessibility

  • Field links the label with htmlFor and joins description and error into aria-describedby.
  • error sets aria-invalid on the control and announces the message with role="alert".
  • required adds aria-required and a visual asterisk that screen readers skip.

Mobile

  • Inputs use a 16px font so iOS doesn't zoom in on focus.
  • 48px tall fields.