From ce05c7f7d3ecde9ec84740bc8f3eebc42bd70dcc Mon Sep 17 00:00:00 2001 From: Csaba Tuncsik Date: Fri, 28 Nov 2025 06:08:42 +0200 Subject: [PATCH] docs: Add component specification and API documentation for N8nInput (#22082) Co-authored-by: Claude --- .../v2/components/Input/component-input.md | 216 ++++++++++++++++++ 1 file changed, 216 insertions(+) create mode 100644 packages/frontend/@n8n/design-system/src/v2/components/Input/component-input.md diff --git a/packages/frontend/@n8n/design-system/src/v2/components/Input/component-input.md b/packages/frontend/@n8n/design-system/src/v2/components/Input/component-input.md new file mode 100644 index 00000000000..c92004604cc --- /dev/null +++ b/packages/frontend/@n8n/design-system/src/v2/components/Input/component-input.md @@ -0,0 +1,216 @@ +# Component specification + +A versatile text input component for collecting user text, numbers, passwords, and other types of single-line or multi-line data. Supports various input types, validation states, and customizable appearance through slots. + +- **Component Name:** N8nInput +- **Figma Component:** [Input](https://www.figma.com/design/8zib7Trf2D2CHYXrEGPHkg/n8n-Design-System-V3?node-id=239-2170&m=dev) +- **Element+ Component:** [ElInput](https://element-plus.org/en-US/component/input.html) +- **Reka UI Component:** N/A (no direct equivalent - will use native HTML input with Editable component for enhanced features) +- **Nuxt UI Component:** [Input](https://ui.nuxt.com/docs/components/input) + +## Public API Definition + +**Props** + +- `modelValue?: string | number | null` - The bound value of the input (v-model). Default: `''` +- `type?: InputType` - Type of input field. Values: `'text' | 'textarea' | 'password'`. Default: `'text'` +- `size?: InputSize` - Size of the input. Values: `'xlarge' | 'large' | 'medium' | 'small' | 'mini'`. Default: `'large'` +- `placeholder?: string` - Placeholder text displayed when input is empty. Default: `''` +- `disabled?: boolean` - When `true`, prevents user interaction and dims the input. Default: `false` +- `clearable?: boolean` - When `true`, displays a clear button (×) when input has a value. Default: `false` +- `rows?: number` - Number of rows for textarea type. Default: `2` +- `maxlength?: number` - Maximum number of characters allowed. +- `autosize?: boolean | { minRows?: number; maxRows?: number }` - Auto-resize textarea height based on content. When `true`, auto-sizes without limits. Object form specifies min/max row constraints. Only applies when `type="textarea"`. Default: `false` +- `autofocus?: boolean` - When `true`, automatically focuses the input on mount. Default: `false` +- `autocomplete?: 'on' | 'off'` - HTML autocomplete attribute. Default: `'off'` + +**Events** + +- `update:modelValue` - Emitted when input value changes. Payload: `[value: string | number | null]` +- `blur` - Emitted when input loses focus. Payload: `[event: FocusEvent]` +- `keydown` - Emitted on keydown event. Payload: `[event: KeyboardEvent]` + +**Slots** + +- `prefix` - Content inside input box, before the text (typically for search icons) +- `suffix` - Content inside input box, after the text (typically for icons or indicators) + +**Exposed Methods** + +- `focus(): void` - Programmatically focus the input element +- `blur(): void` - Programmatically blur the input element +- `select(): void` - Programmatically select all text in the input + +### Template usage examples + +**Basic text input:** +```vue + + + +``` + +**Search input with icon and clear button:** +```vue + + + +``` + +**Textarea with fixed rows:** +```vue + + + +``` + +**Auto-resizing textarea:** +```vue + + + +``` + +**Disabled input:** +```vue + + + +``` + +**Input with suffix icon:** +```vue + + + +``` + +**Input with keydown handler:** +```vue + + + +``` + +**Using exposed methods:** +```vue + + + +```