{"slug":"input","name":"Input","category":"Form & Input","summary":"A single-line text field with an optional label, helper, and error state.","status":"stable","since":"0.1.0","import":"import { Input } from '@elluzion/iv-ui';","usage":["Bind `value` for two-way state: `bind:value`.","The label is rendered inside the field component — no external `<label>` needed.","Pass `error` to switch to the error treatment; `helper` is replaced by the error message."],"props":[{"name":"type","type":"'text' | 'password' | 'email' | 'number' | 'search' | 'url' | 'tel'","default":"'text'","description":"Native input type.","required":false,"bindable":false},{"name":"value","type":"string","default":"''","description":"Current value. Bind with `bind:value`.","required":false,"bindable":true},{"name":"placeholder","type":"string","default":"''","description":"Placeholder shown while the field is empty.","required":false,"bindable":false},{"name":"disabled","type":"boolean","default":"false","description":"Disables interaction and applies the disabled treatment.","required":false,"bindable":false},{"name":"readonly","type":"boolean","default":"false","description":"Prevents editing while keeping the value focusable and readable.","required":false,"bindable":false},{"name":"required","type":"boolean","default":"false","description":"Marks the field as required.","required":false,"bindable":false},{"name":"name","type":"string","default":"''","description":"Form field name submitted with the surrounding form.","required":false,"bindable":false},{"name":"id","type":"string","default":"''","description":"Element id. A generated id is used when omitted.","required":false,"bindable":false},{"name":"autocomplete","type":"HTMLInputAttributes['autocomplete']","default":null,"description":"Native autocomplete hint.","required":false,"bindable":false},{"name":"minlength","type":"number","default":null,"description":"Minimum number of characters.","required":false,"bindable":false},{"name":"maxlength","type":"number","default":null,"description":"Maximum number of characters.","required":false,"bindable":false},{"name":"min","type":"number | string","default":null,"description":"Minimum value for numeric and date types.","required":false,"bindable":false},{"name":"max","type":"number | string","default":null,"description":"Maximum value for numeric and date types.","required":false,"bindable":false},{"name":"pattern","type":"string","default":null,"description":"Regular expression the value must match.","required":false,"bindable":false},{"name":"label","type":"string","default":"''","description":"Visible label for the control.","required":false,"bindable":false},{"name":"error","type":"string","default":"''","description":"Error message. Switches the control to the error treatment.","required":false,"bindable":false},{"name":"helper","type":"string","default":"''","description":"Helper text shown below the control.","required":false,"bindable":false},{"name":"clearable","type":"boolean","default":"false","description":"Shows a reset button while the field has a value.","required":false,"bindable":false},{"name":"size","type":"'sm' | 'md' | 'lg'","default":"'md'","description":"Control size.","required":false,"bindable":false}],"events":[{"name":"input","type":"(e: Event) => void","default":null,"description":"Called on every keystroke with the native event.","required":false,"bindable":false},{"name":"change","type":"(e: Event) => void","default":null,"description":"Called when the value is committed.","required":false,"bindable":false},{"name":"focus","type":"(e: FocusEvent) => void","default":null,"description":"Called when the control receives focus.","required":false,"bindable":false},{"name":"blur","type":"(e: FocusEvent) => void","default":null,"description":"Called when the control loses focus.","required":false,"bindable":false},{"name":"keydown","type":"(e: KeyboardEvent) => void","default":null,"description":"Called on keydown with the native keyboard event.","required":false,"bindable":false}],"snippets":[{"name":"leadingIcon","type":"Snippet","default":null,"description":"Snippet rendered inside the field, before the text.","required":false,"bindable":false},{"name":"trailingIcon","type":"Snippet","default":null,"description":"Snippet rendered inside the field, after the text.","required":false,"bindable":false}],"types":[],"manual":[],"tokens":["--iv_border","--iv_border-error","--iv_border-focus","--iv_border-hover","--iv_control-md","--iv_control-pad-x","--iv_control-pad-x-lg","--iv_control-pad-x-sm","--iv_control-pad-y","--iv_control-pad-y-lg","--iv_control-pad-y-sm","--iv_cursor","--iv_disabled-opacity","--iv_ease-in-out","--iv_error","--iv_error-surface","--iv_font-mono","--iv_font-ui","--iv_foreground","--iv_foreground-dim","--iv_outline-offset","--iv_outline-width","--iv_radius-sm","--iv_ring","--iv_ring-width","--iv_spacing-2xs","--iv_spacing-md","--iv_spacing-sm","--iv_spacing-xs","--iv_surface-overlay","--iv_surface-raised","--iv_text-base","--iv_text-body-sm","--iv_text-label","--iv_text-lg","--iv_text-sm","--iv_transition-base"],"cssHooks":["iv-clear-btn","iv-disabled","iv-error-message","iv-has-error","iv-helper-message","iv-icon","iv-input-lg","iv-input-sm","iv-input-wrapper","iv-label","iv-leading","iv-message","iv-required-mark","iv-trailing"],"accessibility":{"keyboard":[["Tab","Moves focus into the field."],["Escape","Clears the value when `clearable` is set."]],"notes":["The label is associated with the input through a generated id.","Error text is announced through `aria-describedby`; the input also gets `aria-invalid`."]},"related":[{"title":"Field","summary":"Labels a custom control and renders its helper or error message.","url":"/components/field","kind":"Component"},{"title":"Textarea","summary":"A multi-line text field with an optional count and error state.","url":"/components/textarea","kind":"Component"},{"title":"Select","summary":"A custom listbox with search, multiple selection, and clearing.","url":"/components/select","kind":"Component"},{"title":"InputGroup","summary":"Joins an input with prefix and suffix addons inside one frame.","url":"/components/input-group","kind":"Component"}],"examples":[{"id":"states","title":"States","description":"Default, filled, error, disabled, and read-only.","code":"<script lang=\"ts\">\n\timport { Input } from '@elluzion/iv-ui';\n\n\tlet filled = $state('atlas-core');\n</script>\n\n<div class=\"fields\">\n\t<Input label=\"Project name\" placeholder=\"atlas-core\" />\n\t<Input label=\"Slug\" bind:value={filled} helper=\"Lowercase, dashes only.\" />\n\t<Input label=\"Repository\" value=\"atlas/core\" error=\"This repository is already linked.\" />\n\t<Input label=\"Owner\" value=\"elluzion\" disabled />\n\t<Input label=\"Region\" value=\"eu-west-1\" readonly />\n</div>\n\n<style>\n\t.fields {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--iv_spacing-lg);\n\t\twidth: 100%;\n\t\tmax-width: 320px;\n\t}\n</style>"},{"id":"sizes","title":"Sizes","description":"The label and helper scale with the control.","code":"<script lang=\"ts\">\n\timport { Input } from '@elluzion/iv-ui';\n</script>\n\n<div class=\"fields\">\n\t<Input size=\"sm\" label=\"Small\" placeholder=\"sm\" />\n\t<Input size=\"md\" label=\"Medium\" placeholder=\"md\" />\n\t<Input size=\"lg\" label=\"Large\" placeholder=\"lg\" />\n</div>\n\n<style>\n\t.fields {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--iv_spacing-lg);\n\t\twidth: 100%;\n\t\tmax-width: 320px;\n\t}\n</style>"},{"id":"validation","title":"Validation","description":"`error` pairs with `aria-invalid` and `aria-describedby`.","code":"<script lang=\"ts\">\n\timport { Input } from '@elluzion/iv-ui';\n\n\tlet email = $state('');\n\n\tconst error = $derived(\n\t\temail.length === 0 ? '' : email.includes('@') ? '' : 'Enter a valid email address.'\n\t);\n</script>\n\n<div class=\"fields\">\n\t<Input\n\t\ttype=\"email\"\n\t\tlabel=\"Email\"\n\t\tplaceholder=\"you@example.com\"\n\t\tbind:value={email}\n\t\t{error}\n\t\thelper=\"Used for deploy notifications.\"\n\t\trequired\n\t/>\n</div>\n\n<style>\n\t.fields {\n\t\twidth: 100%;\n\t\tmax-width: 320px;\n\t}\n</style>"},{"id":"icons","title":"Leading and trailing icons","description":"Snippets sit inside the field frame; `clearable` adds a reset button.","code":"<script lang=\"ts\">\n\timport { IconAt, IconSearch } from '@tabler/icons-svelte';\n\timport { Input } from '@elluzion/iv-ui';\n\n\tlet query = $state('deployments');\n\tlet email = $state('ada@atlas.dev');\n</script>\n\n<div class=\"fields\">\n\t<Input label=\"Search\" placeholder=\"Search projects…\" bind:value={query}>\n\t\t{#snippet leadingIcon()}\n\t\t\t<IconSearch size={16} />\n\t\t{/snippet}\n\t</Input>\n\t<Input\n\t\ttype=\"email\"\n\t\tlabel=\"Email\"\n\t\tbind:value={email}\n\t\tclearable\n\t\thelper=\"Clearable shows a reset button while filled.\"\n\t>\n\t\t{#snippet leadingIcon()}\n\t\t\t<IconAt size={16} />\n\t\t{/snippet}\n\t</Input>\n</div>\n\n<style>\n\t.fields {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: var(--iv_spacing-lg);\n\t\twidth: 100%;\n\t\tmax-width: 320px;\n\t}\n</style>"}],"markdown":"/components/input.md","page":"/components/input"}