Input
Input is a single-line text field for forms and Active Intelligence experiences. It supports a default form-style appearance and an inline-edit appearance that shows content as static text until focused, plus labels, helper text, validation, a character counter, prefix and suffix slots and a trailing action.
Loading...
Loading...
Overview
Resources
Install
yarn add @camp/inputProps
| Prop | Type | Default | Description |
|---|---|---|---|
action | ReactNode | — | Action displayed at the end of the input after the suffix (e.g. a button). A React element receives `for={inputId}` so it can reference the field; any other node (string, fragment, array) renders as-is. |
appearance | "default" | "inline-edit" | default | Appearance variation |
characterLimit | number | — | Character limit for the input. Displays the counter like `charLimit` and, for parity with the Camp 1 `Input`, also sets the native `maxLength` so the user cannot type past it. An explicit `maxLength` prop wins. @deprecated Use `charLimit` instead (`charLimit` only shows the counter; pass `maxLength` yourself if typing must stop at the limit). |
charLimit | number | — | Character limit for the input. Displays a counter below the input. |
helperText | string | — | Helper text displayed below the input |
htmlSize | number | — | The native `size` attribute (visible width in characters). `size` is taken by the visual variant, so the attribute `AiInput` accepted as `size={number}` lives here. |
inputSize | "default" | "small" | 'default' | Size of the input. 'small' reduces the padding. @deprecated Use `size` instead. |
invalid | boolean | — | Whether the input is in an invalid/error state |
label | string | — | Label text displayed above the input |
labelProps | LabelHTMLAttributes<HTMLLabelElement> | — | Additional props to spread onto the label element (e.g., from downshift for accessibility) |
placeholder | string | — | Placeholder text shown when input is empty. @note Avoid using placeholder when `appearance="inline-edit"`. The inline-edit appearance is designed to display content as static text; placeholder text disrupts this pattern. Consider using a label or default value instead. |
prefix | ReactNode | — | Prefix element displayed at the start of the input (e.g., icon or text). Pass a component directly: ```tsx prefix={<SearchSmall fill="icon-decorative" title="Search" />} ``` |
required | boolean | "invisible" | — | Whether the input field is required. - `true` — sets native `required` + `aria-required`, and shows the required indicator on the Label. - `'invisible'` — sets native `required` + `aria-required` but does **not** show the required indicator on the Label. |
size | "default" | "small" | 'default'
**Migrating from Camp 1?** Camp 1's `size="medium"` has no equivalent here.
Use `size="default"` (or omit the prop) instead. | Size of the input. 'small' reduces the padding. |
suffix | ReactNode | — | Suffix element displayed at the end of the input (e.g., icon or text) |
textAlign | "left" | "center" | 'left' | Text alignment inside the input. |
textAppearance | TextAppearance | — | Typography style for the input text (uses same appearances as Text). Only applies when appearance is 'inline-edit'. |
themed | boolean | true | Whether the component should adapt to the theme context. When false, forces light theme. |
Generated from @camp/input@4.13.8 source, ordered by production usage. * required. † standard HTML attribute — all native attributes are supported; only those with production usage are listed.
Upgrading to Next Gen
🔄 From AI Input (@camp/ai-input): the package is removed; Input in @camp/input is the same component. Replace the import and the JSX tag (AiInput → Input). inputSize → size and characterLimit → charLimit (the old names still work as deprecated aliases). The native width attribute is htmlSize, because size now selects the visual variant.
🔄 From Camp 1 (@activecampaign/camp-components-input or the previous @camp/input): components are named exports, so import Input from '@camp/input' becomes import { Input } from '@camp/input'. size="medium" has no equivalent; use size="default" or omit it. The StyledInputProps type and the flushed / styled-system escape hatches are gone.
🧩 Same behavior: labels, helperText, invalid, charLimit, prefix, suffix, action, appearance (default | inline-edit), themed and native input attributes (value, onChange, disabled, type, and so on) work as before.
🔆 Theming: themed defaults to true, so render inside a ThemeProvider for light and dark support. See Styled Components & ThemeProvider.
Variations
Default
import { Input } from '@camp/input';
<Input label="Default Input" placeholder="Enter text here" />;Required
required sets the native and ARIA required attributes and shows the indicator on the label. Pass required="invisible" to keep the attributes without the indicator.
import { Input } from '@camp/input';
<Input label="Required Input" placeholder="Enter text here" required />;
<Input label="Required Invisible Input" placeholder="Enter text here" required="invisible" />;Prefix and suffix
prefix and suffix take any React node. Use them for a search icon, a unit, or an informational icon. Only small icons fit the input height.
import { Input } from '@camp/input';
import { SearchSmall, InfoCircleSmall } from '@camp/icon';
<Input
label="Input with Prefix and Suffix"
placeholder="Search..."
prefix={<SearchSmall fill="icon-decorative" title="Search" />}
suffix={<InfoCircleSmall fill="icon-decorative" title="Info" />}
/>;Action
action renders after the suffix, outside the field. A React element receives for={inputId} so it can reference the input.
import { Input } from '@camp/input';
import { AiButton } from '@camp/ai-button';
<Input
label="Input with action"
placeholder="Actions available for this input"
action={
<AiButton appearance="primary" size="medium">
Action
</AiButton>
}
/>;Helper text and character limit
helperText renders below the field. charLimit adds a counter; it does not stop typing, so pass maxLength yourself if the value must not exceed the limit.
import { Input } from '@camp/input';
<Input
label="Helper + Char Limit"
placeholder="Enter text"
helperText="Max 30 characters"
charLimit={30}
/>;Invalid
Use invalid when the value fails validation, such as a malformed email or an empty required field, and say what is wrong in helperText.
import { Input } from '@camp/input';
<Input
label="Email"
placeholder="name@example.com"
helperText="Enter a valid email address"
invalid
/>;Disabled
Use disabled sparingly, such as for a locked field: a disabled input is skipped by keyboard navigation and may not be read by a screen reader.
import { Input } from '@camp/input';
<Input label="Disabled Input" placeholder="This is disabled" disabled />;Sizes
Inputs come in two sizes. default is used in most cases and in all forms; small reduces the padding for tight spaces such as a builder sidebar.
import { Input } from '@camp/input';
<Input label="Default Size" placeholder="Default padding" />;
<Input label="Small Size" placeholder="Small padding" size="small" />;Inline-edit appearance
appearance="inline-edit" shows the value as static text until the user focuses it. Use textAppearance to match the surrounding typography. Prefer a value or label over a placeholder, so the content reads as text.
import { Input } from '@camp/input';
<Input
appearance="inline-edit"
label="Editable Title"
value="Click to edit this text"
textAppearance="heading-medium"
/>;Production Examples
More states from @camp/input's visual test stories, ranked by production
usage. Variations already documented above are not repeated here.
Prefix Default
import { Input } from '@camp/input';
const SearchIcon = <SearchSmall fill="icon-decorative" title="Search" />;
<Input
label="Input with Search Prefix"
placeholder="Search..."
prefix={SearchIcon}
/>Suffix Default
import { Input } from '@camp/input';
const InfoIcon = <InfoCircleSmall fill="icon-decorative" title="Info" />;
<Input
label="Input with Info Suffix"
placeholder="Enter text"
suffix={InfoIcon}
/>Inline Edit Default
import { Input } from '@camp/input';
<Input
appearance="inline-edit"
label="Editable Title"
value="Click to edit this text"
/>Inline Edit Hover
import { Input } from '@camp/input';
<Input
appearance="inline-edit"
label="Hover State"
value="Hover to see background"
/>Filled
import { Input } from '@camp/input';
<Input
label="Filled Input"
placeholder="Enter text here"
value="This is filled content"
/>Required Invisible
import { Input } from '@camp/input';
<Input
label="Required Invisible Input"
placeholder="Enter text here"
required="invisible"
/>5 more variations in Storybook
Usage
Basic usage
Input forwards native input attributes, so controlled usage is value plus onChange.
import { useState } from 'react';
import { Input } from '@camp/input';
function MyComponent() {
const [value, setValue] = useState('');
return (
<Input
label="Input label"
placeholder="Enter text here"
value={value}
onChange={(e) => setValue(e.target.value)}
/>
);
}Best practices
- Use the default appearance for form inputs, search fields and data entry
- Use the inline-edit appearance for content users edit in place, such as a page title or heading
- Always provide a label, even if visually hidden; a missing label is an accessibility defect
- Use
invalidwithhelperTextto explain validation errors - Use
type(email,number,password, …) so devices show the right keyboard - Use a Textarea when the expected value is more than one line
Content guidelines
Labels and placeholders are short (no more than three words), in sentence case and without end punctuation. Helper text is in sentence case without end punctuation. Keep articles like "a" and "the"; they help translation. Use inclusive language.
✅ DO
- First name
- Phone number
- Prompt with the placeholder: "name@example.com"
🚫 DON’T
- First Name
- What is your phone number?
- Put required information in the placeholder; it disappears on typing
Placeholders prompt rather than repeat the label: an example of an acceptable value, or an instruction such as "Search". Anything the user needs in order to complete the field belongs in helperText, not the placeholder.
Accessibility
Keyboard support
- Tab: moves focus to the input; Shift + Tab moves it back
- Any key: types; Left / Right arrow move between characters
- Tab again reaches an
action, and Space or Enter activates it
Screen reader support
- The label is the accessible name;
requiredandinvalidare exposed asaria-requiredandaria-invalid helperTextand the character counter are associated with the field and announced- Placeholder text is read when the field is empty (default appearance)


