Talisman LogoTalisman Logo Design System
Browse documentation
Components

Input

A single-line text field for short free-form data such as names, numbers, e-mails and search terms, with optional label, hint and icons.

Stableimport { Input } from "@repo/ui/input";Source

Formato NNNNNNN-DD.AAAA.J.TR.OOOO

size
type
variant
<Input hint="Formato NNNNNNN-DD.AAAA.J.TR.OOOO" label="Número do processo" placeholder="0001234-56.2024.5.02.0001" size="sm" type="text" variant="default" />

SearchInput and CurrencyInput are exported from the same module and are documented below.

When to use

  • To collect one line of free text: process number, client name, e-mail.
  • To collect formatted values with the right native type: password, number, URL.
  • To filter a list or table with SearchInput.
  • To collect an amount in reais with CurrencyInput.

When not to use

  • Several lines of text. Use Textarea.
  • A date. Use Date input, which masks the digits and validates the date.
  • A list of values, such as many process numbers. Use Textarea chips.
  • A one-time code. Use Input OTP.
  • Choosing from a fixed list. Use Select, Radio group or Combobox.

Variants

variant sets the validation state. When no variant is passed, the field is default.

Número encontrado na base.

Número incompleto. Use o formato NNNNNNN-DD.AAAA.J.TR.OOOO.

Processo localizado.

Definido pelo modelo de tarefa.

Variant Use for
default A field with no validation result yet.
error An invalid value. Sets aria-invalid and colors the hint.
success A value confirmed by the system, such as a process found in the base.
blocked A value the user cannot change. Disables the field and drops focus.
ghost A field with no border, for inline editing inside tables and headers.

Sizes

sm is the default and fits most forms. Use md and lg where hit targets must be larger.

Size Height Use for
lg 56px Prominent forms and sign-in pages.
md 48px Touch devices.
sm 40px Default. Forms and dialogs.
xsm 36px Compact layouts and filters.
xxs 32px Dense tables and toolbars.

States

  • Hover darkens the fill and focus swaps the border to --stroke-focus. Both come from the browser, so point at a field or press Tab to see them.
  • Read-only keeps the field focusable and selectable but not editable.
  • Disabled removes the field from the tab order. Prefer blocked when the value must stay visible and the reason is known.
  • Highlight draws an accent border to call attention to a field, for example a required field that was skipped.

Label and hint

Pass label and hint and the field renders the full layout: label row, field, hint. The label is linked to the input and the hint is referenced by aria-describedby.

Obrigatório

Use o e-mail corporativo cadastrado no cliente.

Icons

Use iconLeading for the kind of data and iconTrailing for status. Both are sized to 16px and hidden from assistive technology, so never rely on them alone.

Types

SearchInput adds a search icon and, once there is text, a clear button. Escape clears the text.

With collapsible, the field is an icon button until it is opened, which saves room in toolbars.

Currency

CurrencyInput masks the digits as reais. Its onChange receives only the digits, in cents, so "1500000" means 15.000,00.

O segundo campo começa com 1500000 centavos, exibido como 15.000,00.

Content

  • Label with the noun, in sentence case: “Número do processo”, “Nome do cliente”.
  • Use the placeholder for an example, never for the label: “0001234-56.2024.5.02.0001”.
  • Write the hint as the rule or the fix: “Use o formato NNNNNNN-DD.AAAA.J.TR.OOOO.”
  • Without label, give the input an aria-label.

Do and don’t

Use o formato NNNNNNN-DD.AAAA.J.TR.OOOO.

DoKeep a visible label and use the hint to explain the rule.
Don'tDon't use the placeholder as the only label. It disappears as soon as the user types.

Número incompleto. Use o formato NNNNNNN-DD.AAAA.J.TR.OOOO.

DoSay what is wrong and how to fix it.
Don'tDon't show an error with no explanation. The user can't tell what to correct.

Accessibility

  • It renders a native <input>, so browser autofill, spell checking and the right on-screen keyboard work with the native type.
  • With label, a <label htmlFor> is linked to the input through a generated id. Without it, pass aria-label: a field with no name fails WCAG AA.
  • variant="error" sets aria-invalid and hint is referenced by aria-describedby. Say the error in text: color alone is not enough.
  • Icons are aria-hidden. A status icon needs matching text in the hint.
  • Focus changes the border to the focus token. The native outline is removed.
  • Hit targets run from 32px (xxs) to 56px (lg), above the 24px minimum.
  • SearchInput names its buttons “Abrir pesquisa” and “Limpar pesquisa”. The text is fixed in the component.

Code

import { CurrencyInput, Input, SearchInput } from "@repo/ui/input";

<Input
  hint="Use o formato NNNNNNN-DD.AAAA.J.TR.OOOO."
  label="Número do processo"
  placeholder="0001234-56.2024.5.02.0001"
/>

// Icons
<Input aria-label="E-mail" iconLeading={<Mail />} type="email" />

// Search
<SearchInput onChange={(e) => setQuery(e.target.value)} value={query} />

// Currency: onChange receives digits in cents
<CurrencyInput
  aria-label="Valor da causa"
  onChange={(e) => setAmount(e.target.value)}
  value={amount}
/>

Props

Input
PropTypeDefaultDescription
disabledbooleanfalseDisables the field. Disabled fields cannot be focused
highlightbooleanfalseDraws a highlight border to call attention to the field
hintstring—Helper or error text below the field. Its color follows `variant`, and the input references it with `aria-describedby`
iconLeadingReactNode—Icon on the leading side, sized to 16px. Pass a Lucide element
iconTrailingReactNode—Icon on the trailing side, sized to 16px. Its color follows `variant`
labelstring—Label above the field, linked to the input. Without `label` and `hint` the bare field renders
leftReactNode—Custom node on the leading side. Wins over `iconLeading`
placeholderstring—Text shown while the field is empty
rightReactNode—Custom node on the trailing side. Wins over `iconTrailing`
size"lg" | "md" | "sm" | "xsm" | "xxs"smHeight, padding and type size
trailingTextstring—Secondary text at the end of the label row, such as a counter. Only shown with `label`
type"text" | "email" | "password" | "number" | "tel" | "url"textNative input type
variant"blocked" | "default" | "error" | "ghost" | "success"defaultValidation state. `error` also sets `aria-invalid`; `blocked` disables the field
SearchInput (also takes the Input props, except label, hint and trailingText)
PropTypeDefaultDescription
collapsiblebooleanfalseShows an icon button that expands into the field, and collapses on blur when empty.
expandedWidthstring"280px"Width of the field when `collapsible` is open.
onClear() => void—Called when the user clears the text. Without it, `onChange` receives an empty value.
placeholderstring"Pesquisar…"Text shown while the field is empty.
value, onChangestring, (event) => void—Controlled text. The clear button shows when `value` is not empty.
CurrencyInput (also takes the Input props)
PropTypeDefaultDescription
valuestring—Amount in cents as digits, for example `"1500000"`.
onChange(event) => void—Called with `event.target.value` set to the digits only, in cents.

Known issues

Issue Effect
Hover uses hover:bg-neutral-black/5 and disabled uses disabled:opacity-50. Translucent fills, which the repository avoids. The disabled value loses contrast and may fail WCAG AA.
The hint is a raw <p> with text-xs, and the label is a raw <label>. They do not follow the Typography scale tokens.
SearchInput hardcodes “Pesquisar…”, “Abrir pesquisa” and “Limpar pesquisa”. Apps cannot translate these. Only the placeholder can be overridden.
SearchInput uses text-muted-foreground for the collapsible icon. A token from the old color system, unlike the text-tertiary used when it is not collapsible.
CurrencyInput formats an empty value as “0,00”. The placeholder never shows, and an empty field looks like the value zero. There is no “R$” prefix.
Edit this page on GitHub