Text inputs are used to collect text from the user. They are commonly used in forms and settings pages.
state
default
default
success
warning
error
size
medium
x-small
(height: 20px)small
(height: 26px)medium
(height: 30px)large
(height: 36px)block
false
true
, the text input will take the full width of its parent.value
undefined
input
<input>
element (bindable).<TextInput placeholder="Basic text input" bind:value={myValue} />
The value is "{myValue}"
<TextInput placeholder="X-Small" size="x-small" />
<TextInput placeholder="Small" size="small" />
<TextInput placeholder="Medium (default)" />
<TextInput placeholder="Large" size="large" />
<TextInput
placeholder="This is a default text input"
state="default"
block
/>
<TextInput
placeholder="This is a success text input"
state="success"
block
/>
<TextInput
placeholder="This is a warning text input"
state="warning"
block
/>
<TextInput
placeholder="This is an error text input"
state="error"
block
/>
<TextInput placeholder="Search">
<IconSearch slot="start" />
</TextInput>
<TextInput placeholder="Delay" type="number">
<span slot="end">minutes</span>
</TextInput>
The ending slot is useful with the Loader component to indicate a loading state, for example in a search input.
<TextInput select bind:value={selectValue}>
<option value="1">1 minute</option>
<option value="5">5 minutes</option>
<option value="10">10 minutes</option>
<option value="15">15 minutes</option>
</TextInput>