Field

Label, description and error message around a form control.

Import

import { Field } from "@tarve/core";

Usage

Field.tsx
import { Field, Input } from "@tarve/core";

let username = "ad";

<Field
  label="Username"
  description="This is your public display name."
  error={username.length < 3 ? "Use at least 3 characters." : undefined}
  required
>
  <Input
    value={username}
    onChange={(value) => {
      username = value;
    }}
  />
</Field>

Props

PropTypeDefault
description string—
disabled boolean—
error string—
label string—
required boolean—

Common props

Shared by every component. See descriptions →

childrenhighlightidkeymotionFromonHighlightonPasteonTransitionEndrovingGroupstyle