Input
Joined Inputs
NewTwo to four fields joined into one box, such as first and last name, with an outline only around the field in use.
npx motionsnack add joined-inputsCustomize
<JoinedInputs />Props
20 properties
| Property | Type | Default | Description |
|---|---|---|---|
| value | string[] | - | Controlled values, one per field. Leave undefined to let the component manage them. |
| defaultValue | string[] | [] | Values on first render when uncontrolled. |
| onChange | (values: string[]) => void | - | Called with all values whenever one changes. |
| names | string | 'firstName, lastName' | Form names of the fields, separated by commas. |
| autoCompletes | string | 'given-name, family-name' | Autocomplete hints of the fields, separated by commas. |
| errorColor | string | undefined | Error colour for both themes. Undefined uses the per-theme pair (#dc2626 light, #ef4444 dark). |
| id | string | generated | Id prefix of the inputs. |
| className | string | '' | Extra classes on the wrapper. |
| label | string | 'Full name' | Label above the whole group. Empty hides it. |
| fieldLabels | string | 'First name, Last name' | Labels of the fields, separated by commas. Their count (2 to 4) sets how many fields there are. |
| placeholders | string | 'Jane, Doe' | Hints of the fields, separated by commas. |
| widths | string | '1, 1' | Relative widths of the fields, separated by commas, e.g. 2, 1. |
| labelStyle | 'inside' | 'none' | 'inside' | Field labels as small text inside each field, or placeholders only. |
| helperText | string | 'As it should appear on the invoice.' | Small text under the group. Empty hides it. |
| error | string | '' | Error message. Any text switches the group to its error state. |
| required | boolean | false | Marks every field as required. |
| disabled | boolean | false | Disables the group. |
| height | number | 48 | Height of one field (48, or 40 compact). |
| radius | number | 12 | Corner radius of the group. |
| stackBelow | number | 420 | Below this width of the group the fields stack under each other. |
About Joined Inputs
Joined Inputs puts fields that belong together into one shared box: first and last name, street and number, city and postcode. Each field keeps a small label inside its top edge, or just a placeholder, and the field being typed in gets the library's clear focus outline on top of the shared border. Labels, placeholders, names, autocomplete hints and relative widths are plain comma-separated props, so two fields become three or four by adding a word. Below a width you set the fields stack under each other, decided by the width of the group itself rather than the screen. Helper text, required and error states cover the whole group.
What's included
- Two to four fields in one shared box
- Focus outline on the field in use
- Labels inside each field or placeholders only
- Relative widths per field
- Stacks by the group's own width
- Helper text, required and error states
- Light and dark look
- Type
- Animated React input component
- Library
- Components · Input
- Stack
- Next.js, React, Tailwind CSS
- Added
- 2026-11-23
- Install
npx motionsnack add joined-inputs