Skip to content
Discussion options

You must be logged in to vote

Yes — no JavaScript needed. BbTextarea exposes both:

<BbTextarea @ref="notes" @bind-Value="text" />
<BbButton OnClick="@(() => notes!.FocusAsync())">Focus</BbButton>

@code {
    private BbTextarea? notes;
}
  • FocusAsync() returns a ValueTask and focuses the underlying element.
  • Element gives you the ElementReference if you need it for something else.

BbInput and the other text inputs carry the same pair. Sorry this sat unanswered for so long.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mathewtaylor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants