Skip to content

Input

One line of text typed by the person: a name, an email, a number, a date. It is the platform’s own input, so phones show the right keyboard and browsers can fill it in.

import { Input } from '@sypnia/ui/react'

On this page
  1. Kinds of value
  2. Sizes
  3. States
  4. When to use it
  5. For everyone
  6. Props

Kinds of value

The type decides the keyboard on a phone and the checks the browser makes.

Code
import { Field, FormGrid, Input } from '@sypnia/ui/react';

// The type decides the keyboard a phone shows and what the browser can fill in.
export default function Kinds() {
  return (
    <FormGrid>
      <Field label="Full name"><Input autoComplete="name" defaultValue="Laura Méndez" /></Field>
      <Field label="Work email"><Input type="email" autoComplete="email" placeholder="laura@northwind.io" /></Field>
      <Field label="Rows per page"><Input type="number" min={10} max={100} step={5} defaultValue={25} /></Field>
      <Field label="Keep backups until"><Input type="date" defaultValue="2026-12-31" /></Field>
    </FormGrid>
  );
}

Sizes

Small for toolbars and tables, medium for forms, large for sign-in and search.

Code
import { Input } from '@sypnia/ui/react';

export default function Sizes() {
  return (
    <div className="sy-cols sy-cols--stack">
      <Input size="sm" aria-label="Filter, small" placeholder="Small: toolbars and tables" />
      <Input aria-label="Filter, medium" placeholder="Medium: forms" />
      <Input size="lg" aria-label="Filter, large" placeholder="Large: sign-in and search" />
    </div>
  );
}

States

Empty, filled, with an error, disabled, read only and machine text. Press Tab to see the focus.

There is already a table called orders.

Only the owner can rename the project.

It can be selected and copied, not changed.

Ids, keys and code use the mono face.

Code
import { Field, FormGrid, Input } from '@sypnia/ui/react';

// Press Tab to see the focus: the border lights up and a halo surrounds the field.
export default function States() {
  return (
    <FormGrid>
      <Field label="Empty, with an example"><Input placeholder="orders" /></Field>
      <Field label="Filled"><Input defaultValue="orders" /></Field>
      <Field label="With an error" error="There is already a table called orders."><Input defaultValue="orders" /></Field>
      <Field label="Disabled" hint="Only the owner can rename the project."><Input disabled defaultValue="Storefront" /></Field>
      <Field label="Read only" hint="It can be selected and copied, not changed."><Input readOnly defaultValue="eu-central-1" /></Field>
      <Field label="Machine text" hint="Ids, keys and code use the mono face."><Input machine defaultValue="prj_8f2k1x9c" /></Field>
    </FormGrid>
  );
}

When to use it

Use it when

  • The answer is short and fits on one line.
  • Set type and autoComplete so phones show the right keyboard and the browser offers what it already knows.
  • The value is an ID, a key or code: add machine for the mono face.

Do not use it when

  • The text can be long or have several lines: that is a Textarea.
  • The person chooses from a known list: NativeSelect, Radio or Combobox.
  • It would stand without a label. Put it in a Field, or give it aria-label when the place makes its purpose obvious (a filter in a toolbar).

For everyone

  • Inside a Field it takes the label, the hint and the error by itself.
  • Focus is shown with the border and a halo, never by colour alone and never removed.
  • A disabled input cannot be focused or read by everyone; if the value matters, use readOnly, which can be focused and copied.
  • On touch screens the text is 16 px, so iOS does not zoom into the field.

Props

InputTypeDefault
machine

Machine text (ids, keys, code): set in the mono face.

boolean
size "sm" | "md" | "lg"
  1. Kinds of value
  2. Sizes
  3. States
  4. When to use it
  5. For everyone
  6. Props

    Search pages, sections and terms