logo-icon
STWUI

Input

Input is a simple input field.



You're doing it wrong!



svelte
<script lang="ts">
	import { Input } from 'stwui';

	const email = "svg-path";
	const phone = "svg-path";
	const lock = "svg-path";
</script>

<Input name="input-1" placeholder="Basic" allowClear />

<Input name="input-2" allowClear>
	<Input.Label slot="label">Label</Input.Label>
	<Input.Leading slot="leading" data={email} />
	<Input.Trailing slot="trailing" data={phone} />
</Input>

<Input
	name="input-3"
	error="There has been an error"
	handleLeadingClick={() => console.log('clicking leading')}
>
	<Input.Label slot="label">Label</Input.Label>
	<Input.Leading slot="leading" data={email} />
	<Input.Trailing slot="trailing" data={phone} />
</Input>

<Input type="password" name="input-4" showPasswordToggle>
	<Input.Label slot="label">Password</Input.Label>
	<Input.Leading slot="leading" data={lock} />
</Input>

Input Props

name string
type 'text' | 'email' | 'password' text
error string | undefined
placholder string | undefined
value string | undefined
autocomplete 'on' | 'off' | undefined
autocapitalize 'off' | 'none' | 'sentences' | 'words' | 'characters' off
readonly true | undefined
tabindex string | undefined
showPasswordToggle boolean false
allowClear boolean false

Input Slots

label <Input.Label slot="label" />
leading <Input.Leading slot="leading" />
trailing <Input.Trailing slot="trailing" />

Input.Label Slots

default

Input.Leading Props

data string (IconData)
viewBox string 0 0 24 24
size string 24px
width string 24px
height string 24px
color string currentColor
stroke string | undefined
fill string currentColor

Input.Trailing Props

data string (IconData)
viewBox string 0 0 24 24
size string 24px
width string 24px
height string 24px
color string currentColor
stroke string | undefined
fill string currentColor