Replies: 1 comment
-
<script>
import { TextInput } from "carbon-components-svelte";
let ref;
</script>
<TextInput bind:ref />
<button on:click={() => ref?.focus()}>
Focus
</button> |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
geoidesic
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
https://carbondesignsystem.com/components/text-input/usage/
According to the docs, the only way is using tab.
Normally with an input I would do:
Then inputEL has a focus method that I can call to focus the element. But with TextInput, it doesn't work:
In this case inputEL is a svelte component, not an HTMLelement, so it doesn't have the focus method.
So how can I focus the text input from the parent?
Beta Was this translation helpful? Give feedback.
All reactions