Field
A control with its label, hint and error. Built on ui-sdk's Field: the label names the control, the hint describes it, and the error marks it invalid and is announced. The error sits in the gap under the control, aligned to its end edge, so showing it never moves the form.
BetaReady to use. Its API can still change in a minor release; the changelog says when.
import { Field, Input } from "@leap-crm/design-system";Playground
Change a prop and the component follows. Its code is under Props.
As it appears on their ID.
Props
label
optional
hint
error
invalid
disabled
counter
Best practices
When to use it, and the rules that apply in particular places.
| Guidance | Practice |
|---|---|
| Do | Wrap every form control in a Field, like an Input, a Textarea or a Select, so the label names it and the error is announced. |
| Do | Write error as what to do, like "Please enter a valid email". It takes the hint's place or sits in the gap under the control, so the form doesn't move. |
| Do | Set invalid with no message on a field whose partner holds the error, like a start time when the end time says it must be later. |
| Do | Put a status badge or an info tooltip in labelAside, not in label, so it sits on the label's line without becoming part of the control's name. |
| Don't | Show CharacterCount from the first character on a long limit. Set showFrom near the limit: a counter over every short entry nags. |
| Don't | Dim a field yourself with opacity. Set disabled, which disables the control and dims the whole field together. |
Props
Field
| Prop | Type | Default | Description |
|---|---|---|---|
| label | ReactNode | — | Names the control. The red asterisk follows the control's own `required`. |
| optional | boolean | false | Shows a muted "Optional" after the label. |
| labelAside | ReactNode | — | Sits on the label's line after it, like a status badge or an info tooltip. |
| hint | ReactNode | — | A line under the control. An error takes its place, so nothing moves. |
| error | ReactNode | — | The error, like "Please enter a valid email". It shows the field as invalid and is announced. |
| invalid | boolean | — | Shows the field as invalid without a message, like when another field holds the error. |
| counter | ReactNode | — | At the end of the hint line, like a CharacterCount. |
| name | string | — | The name the control submits under, when it doesn't set its own. |
| disabled | boolean | — | Disables the control and dims the whole field. |
| className | string | — | Classes added to the root element, merged with its own. Tokens only. |
| children * | ReactNode | — | The control: an Input, a Textarea or any ui-sdk control. |
CharacterCount
| Prop | Type | Default | Description |
|---|---|---|---|
| length * | number | — | How many characters the text has now. |
| max * | number | — | The limit. The count turns red at it. |
| showFrom | number | 0 | The length above which it appears. |
Code
What the playground shows, ready to copy.
import { Field, Input } from "@leap-crm/design-system";
<Field label="Full name" hint="As it appears on their ID.">
<Input defaultValue="Jane Citizen" />
</Field>






