Input
Input captures short text, search, password, and textarea input.
@duskmoon-dev/components/input Usage
When to use
- Use it inside forms, filters, settings, and any workflow that captures user input.
- Prefer controlled props when the value must stay synchronized with application state.
Implementation notes
Features
Documents default values, value props, and change callbacks for form integration.
Surfaces status, size, disabled, and option data patterns where the component supports them.
Input is most often configured through `allowClear`, `prefix`, `size`, `status`.
Renders parity input props
Feature Demos
Feature demos are authored for the component page, then supplemented with behavior scenarios from the component test coverage.
Basic usage
Import the component stylesheet and Input from its package subpath, then render it with the core props.
import "@duskmoon-dev/components/styles.css";
import { Input } from "@duskmoon-dev/components/input";
export function Example() {
return (<Input
status="success"
/>);
} Renders parity input props
test-backedInput scenario from the component test coverage: renders parity input props.
import "@duskmoon-dev/components/styles.css";
import { Input } from "@duskmoon-dev/components/input";
export function InputRendersParityInputPropsDemo() {
return (<Input
// Renders parity input props
status="success"
/>);
} Supports status, size, variant, prefix, and suffix
test-backedInput scenario from the component test coverage: supports status, size, variant, prefix, and suffix.
import "@duskmoon-dev/components/styles.css";
import { Input } from "@duskmoon-dev/components/input";
export function InputSupportsStatusSizeVariantDemo() {
return (<Input
// Supports status, size, variant, prefix, and suffix
status="success"
/>);
} AllowClear clears uncontrolled value and calls onChange
test-backedInput scenario from the component test coverage: allowclear clears uncontrolled value and calls onchange.
import "@duskmoon-dev/components/styles.css";
import { Input } from "@duskmoon-dev/components/input";
export function InputAllowClearClearsUncontrolledValueDemo() {
return (<Input
// AllowClear clears uncontrolled value and calls onChange
status="success"
/>);
} Search calls onSearch from enter key and enter button
test-backedInput scenario from the component test coverage: search calls onsearch from enter key and enter button.
import "@duskmoon-dev/components/styles.css";
import { Input } from "@duskmoon-dev/components/input";
export function InputSearchCallsOnSearchFromDemo() {
return (<Input
// Search calls onSearch from enter key and enter button
status="success"
/>);
} Password renders as password and toggles visibility
test-backedInput scenario from the component test coverage: password renders as password and toggles visibility.
import "@duskmoon-dev/components/styles.css";
import { Input } from "@duskmoon-dev/components/input";
export function InputPasswordRendersAsPasswordDemo() {
return (<Input
// Password renders as password and toggles visibility
status="success"
/>);
} TextArea renders class props and showCount
test-backedInput scenario from the component test coverage: textarea renders class props and showcount.
import "@duskmoon-dev/components/styles.css";
import { Input } from "@duskmoon-dev/components/input";
export function InputTextAreaRendersClassPropsDemo() {
return (<Input
// TextArea renders class props and showCount
status="success"
/>);
} TextArea updates showCount for uncontrolled changes
test-backedInput scenario from the component test coverage: textarea updates showcount for uncontrolled changes.
import "@duskmoon-dev/components/styles.css";
import { Input } from "@duskmoon-dev/components/input";
export function InputTextAreaUpdatesShowCountForDemo() {
return (<Input
// TextArea updates showCount for uncontrolled changes
status="success"
/>);
} Group wraps children with input-group
test-backedInput scenario from the component test coverage: group wraps children with input-group.
import "@duskmoon-dev/components/styles.css";
import { Input } from "@duskmoon-dev/components/input";
export function InputGroupWrapsChildrenWithDemo() {
return (<Input
// Group wraps children with input-group
status="success"
/>);
} Theme aware
Docs previews inherit the DuskMoon data-theme value. Use the header switch to compare light and dark rendering.
<div data-theme="sunshine">
<Input
status="success"
/>
</div>
<div data-theme="moonlight">
<Input
status="success"
/>
</div> API
The API reference below lists every parsed exported type or interface for Input. Start with `allowClear`, `prefix`, `size`, `status` for common usage.
packages/components/src/components/input/Input.types.ts
Scenarios: packages/components/src/components/input/Input.test.tsx | Prop | Type | Required | Description |
|---|---|---|---|
allowClear | boolean | No | allowClear configures Input. |
className | string | No | className configures Input. |
prefix | ReactNode | No | prefix configures Input. |
size | InputSize | No | size configures Input. |
status | InputStatus | No | status configures Input. |
suffix | ReactNode | No | suffix configures Input. |
type | ComponentProps<"input">["type"] | No | type configures Input. |
variant | InputVariant | No | variant configures Input. |
onChange | (event: InputChangeEvent) => void | No | onChange configures Input. |
| Prop | Type | Required | Description |
|---|---|---|---|
enterButton | ReactNode | No | enterButton configures Input. |
loading | boolean | No | loading configures Input. |
onSearch | ( | No | onSearch configures Input. |
value | string, | Yes | value configures Input. |
event | KeyboardEvent<HTMLInputElement> | MouseEvent<HTMLElement>, | No | event configures Input. |
| Prop | Type | Required | Description |
|---|---|---|---|
visibilityToggle | boolean | No | visibilityToggle configures Input. |
| Prop | Type | Required | Description |
|---|---|---|---|
autoSize | boolean | { minRows?: number; maxRows?: number } | No | autoSize configures Input. |
className | string | No | className configures Input. |
showCount | boolean | No | showCount configures Input. |
size | InputSize | No | size configures Input. |
status | InputStatus | No | status configures Input. |
variant | InputVariant | No | variant configures Input. |
resize | TextAreaResize | No | resize configures Input. |
onChange | (event: TextAreaChangeEvent) => void | No | onChange configures Input. |
"sm" | "md" | "lg" "error" | "success" "filled" | "outlined" "none" | "both" | "horizontal" | "vertical" ChangeEvent<HTMLInputElement> ChangeEvent<HTMLTextAreaElement> ComponentProps<"div"> ForwardRefExoticComponent< InputProps & RefAttributes<HTMLInputElement> > & { Search: ForwardRefExoticComponent< SearchProps & RefAttributes<HTMLInputElement> >