SpecOS SpecOS icon Styleguide

TextInput

A versatile text input component supporting various input types including text, password, phone number, and email with icon support and status states.

Import

import TextInput from "$lib/components/TextInput.svelte";

Basic Example

<TextInput
    bind:value={textValue}
    label="Basic Text Input"
    placeholder="Enter some text"
    icon="Edit"
/>

Password Input

<TextInput
    bind:value={passwordValue}
    type="password"
    label="Password Input"
    placeholder="Enter your password"
    icon="Lock"
/>

Phone Number Input

<TextInput
    bind:value={phoneValue}
    type="phone"
    label="Phone Number"
    placeholder="Enter phone number"
    icon="Phone"
/>

Styled Example with Copy Button

<TextInput
    bind:value={emailValue}
    type="email"
    label="Email Input"
    placeholder="Enter your email"
    icon="Mail"
    status="success"
    showCopyButton={true}
/>

Properties

value
Type
string
Default: ""
The input value
type
Type
"text" | "password" | "phone" | "email"
Default: "text"
The type of input field
placeholder
Type
string
Default: ""
Placeholder text for the input
icon
Type
string
Default: ""
Icon name to display before the input
label
Type
string
Default: ""
Label text for the input field
name
Type
string
Default: ""
Name attribute for the input field
id
Type
string
Default: ""
ID attribute for the input field
disabled
Type
boolean
Default: false
Whether the input is disabled
status
Type
"neutral" | "warning" | "success" | "error" | "label-error" | "label"
Default: "neutral"
Status/state of the input field
showCopyButton
Type
boolean
Default: false
Show a copy button to copy input value
iconSize
Type
string
Default: "size-7"
Size class for the icon