carbon-components-svelte/tests/TextInput.test.svelte
Sam 9efe5255d2 feat!: TextInput v11 Styles (#1889)
* Initial commit

* Fixes [FluidForm] TextInput error icon is misplaced #1667

* Contributes to [TextInput] helperText enhancements #1633

* Adopts Standardize props and events #1621

* Added slots for Standardize props and events #1621

* Added pointer events, updated skeleton TextInput v11 #1888

* Address a bug in the word counter regex

* Update src/TextInput/TextInput.svelte

Correcting type attribute definition for HTML attributes

Co-authored-by: Enrico Sacchetti <esacchetti@gmail.com>

* Update src/TextInput/TextInput.svelte

Correcting type attribute definition for HTML attributes

Co-authored-by: Enrico Sacchetti <esacchetti@gmail.com>

* Update src/TextInput/TextInput.svelte

Explicitly define default value for `size`

Co-authored-by: Enrico Sacchetti <esacchetti@gmail.com>

* Adopted suggested changes

* Updated `TextInput.test`; added forgotten files from previous

---------

Co-authored-by: Samuel Janda <hi@simpleprogramming.com.au>
Co-authored-by: Enrico Sacchetti <esacchetti@gmail.com>
2024-03-23 16:47:54 -07:00

51 lines
1.2 KiB
Svelte

<script lang="ts">
import { TextInput, TextInputSkeleton } from "../types";
let value = null;
</script>
<TextInput
labelText="User name"
placeholder="Enter user name..."
bind:value="{value}"
on:input="{(e) => console.log(e)}"
on:change="{(e) => (value = e)}"
on:paste="{(e) => console.log(e)}"
inputAttributes="{{ type: 'number' }}"
/>
<TextInput
labelText="User name"
helperText="Your user name is associated with your email"
placeholder="Enter user name..."
/>
<TextInput
labelText="Username"
placeholder="Enter username..."
maxCount="{32}"
counter
/>
<TextInput hideLabel labelText="User name" placeholder="Enter user name..." />
<TextInput light labelText="User name" placeholder="Enter user name..." />
<TextInput inline labelText="User name" placeholder="Enter user name..." />
<TextInput size="lg" labelText="User name" placeholder="Enter user name..." />
<TextInput size="sm" labelText="User name" placeholder="Enter user name..." />
<TextInput
invalid
invalidText="User name is already taken. Please try another."
labelText="User name"
placeholder="Enter user name..."
/>
<TextInput disabled labelText="User name" placeholder="Enter user name..." />
<TextInputSkeleton />
<TextInputSkeleton hideLabel />