Input

A one-line text field: xs 28, sm 32, md 36 (forms) and lg 40. Built on ui-sdk's Input and InputGroup, so a press on an affix focuses the field, and it wires itself to the Field around it.

BetaReady to use. Its API can still change in a minor release; the changelog says when.

import { Input } from "@leap-crm/design-system";

Playground

Change a prop and the component follows. Its code is under Props.

Props

clearable
copyable
validation
size
placeholder
prefix
suffix
disabled
readOnly

Best practices

When to use it, and the rules that apply in particular places.

GuidancePractice
DoPut it in a Field for its label, hint and error. Alone, like a search in a table toolbar, name it with aria-label.
DoUse prefix and suffix for units, like $ before a fee or % after a discount, so the person types only the number.
DoUse validation for a check that takes a moment, like whether an email is already on a contact, and put what to do in the Field's error. The cross alone doesn't say what's wrong.
DoSet copyable on a value people paste elsewhere, like a trust account reference, and clearable on a search or filter.
Don'tUse it for several lines of text, like a file note. Use Textarea.
Don'tUse it for a date or a one-time code. Use DateInput or DatePicker for a date and CodeInput for a code.

Props

Also takes every native input prop (type, placeholder, required, readOnly, disabled, ref, onChange…) and ui-sdk's value, defaultValue and onValueChange.

PropTypeDefaultDescription
sizeTextSize"md"xs 28, sm 32, md 36 (forms, the default), lg 40. On touch screens the text is 16 px, so iOS doesn't zoom.
prefixReactNode—Muted text before the value, like a currency sign.
suffixReactNode—Muted text after the value, like a percent sign.
clearablebooleanfalseShows a × that empties the field while it holds text.
copyablebooleanfalseShows a button that copies the value.
validation"checking" | "valid" | "invalid"—A check run on the value, like whether an email is taken: checking spins at the end of the field, then turns into a tick (valid) or a cross (invalid) that draws itself in. Put the message in the Field's error.
classNamestring—Classes for the box around the text, which draws the edge and the states.

Code

What the playground shows, ready to copy.

import { Input } from "@leap-crm/design-system";

<Input aria-label="Full name" placeholder="Jane Citizen" />