Skip to content

Commit cf45532

Browse files
docs(RadioGroup): update focus documentation (#2903)
* docs(RadioGroup): update focus documentation * Update components/radiogroup/overview.md Co-authored-by: Yordan <[email protected]> * Update components/radiogroup/overview.md Co-authored-by: Yordan <[email protected]> --------- Co-authored-by: Yordan <[email protected]>
1 parent aa8f287 commit cf45532

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

components/radiogroup/overview.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,12 @@ See the [Input Validation](slug:common-features/input-validation) article for mo
103103

104104
## RadioGroup Reference and Methods
105105

106-
The RadioGroup provides a `FocusAsync` method that allows the application to focus the component programmatically. First, obtain reference to the component through its `@ref` attribute.
107-
@[template](/_contentTemplates/common/inputs.md#focus-kb)
106+
The RadioGroup provides a `FocusItemAsync` method that allows the application to focus a specific radio input programmatically. It accepts an integer parameter representing the index of the radio button you want to focus. To use it, obtain the component reference through its `@ref` attribute.
108107

109-
>caption Using RadioGroup methods
108+
>caption Using RadioGroup `FocusItemAsync` method
110109
111110
````RAZOR
112-
<TelerikButton OnClick="@FocusRadioGroup">Focus RadioGroup</TelerikButton>
111+
<TelerikButton OnClick="@FocusLastRadioItem">Focus Last Radio Item</TelerikButton>
113112
114113
<TelerikRadioGroup @ref="@RadioGroupRef"
115114
Data="@RadioGroupData"
@@ -119,7 +118,7 @@ The RadioGroup provides a `FocusAsync` method that allows the application to foc
119118
</TelerikRadioGroup>
120119
121120
@code{
122-
private TelerikRadioGroup<ListItem, int?> RadioGroupRef { get; set; }
121+
private TelerikRadioGroup<ListItem, int?>? RadioGroupRef { get; set; }
123122
124123
private int? RadioGroupValue { get; set; }
125124
@@ -129,9 +128,10 @@ The RadioGroup provides a `FocusAsync` method that allows the application to foc
129128
new ListItem { Id = 3, Text = "Baz" }
130129
};
131130
132-
private async Task FocusRadioGroup()
131+
private async Task FocusLastRadioItem()
133132
{
134-
await RadioGroupRef.FocusAsync();
133+
// focus last radio item
134+
await RadioGroupRef!.FocusItemAsync(2);
135135
}
136136
137137
public class ListItem

0 commit comments

Comments
 (0)