Please expose the ability to set an Id on the Chip and ChipList components.
Example:
<TelerikChip Id="chipid"></TelerikChip>
<TelerikChipList Id="chipid"></TelerikChipList>
Hello Dale,
Thank you for the follow-up.
The addition of the Id parameter is a valid feature request for the Chip component. You can bind the value of the Chip to a bool and it can be easily validated with the built-in data annotations.
The ChipList is bound to a collection of models. In .NET there is no built-in validation for a collection, thus the component is not meant to be a part of a Form. That being said, I should decline the addition of the Id parameter. The solution would be to wrap the ChipList with an HTML element and pass an Id to that wrapping element:
<label for="chip-list-label">Chips:</label>
<span id="chip-list-label">
<TelerikChipList Data="@ChipListSource"
TextField="@(nameof(ChipModel.ChipText))"
IconField="@(nameof(ChipModel.ChipIcon))">
</TelerikChipList>
</span>
@code {
private List<ChipModel> ChipListSource { get; set; } = new List<ChipModel>()
{
new ChipModel()
{
ChipText = "Audio",
ChipIcon = FontIcon.FileAudio
},
new ChipModel()
{
ChipText = "Video",
ChipIcon = FontIcon.FileVideo
}
};
public class ChipModel
{
public string ChipText { get; set; }
public FontIcon? ChipIcon { get; set; }
}
}
Regards,
Svetoslav Dimitrov
Progress Telerik
Hello Dale,
Can you follow up with some information on the need for an Id parameter for the ChipList, would you want it for styling purposes? If that is the case, I can suggest you use the Class attribute that is already available for the ChipList and Chip.
If you are going to use the Id parameter to attach a label to the Chip in a Form, I would like to say that this is a valid request.
The usage of a ChipList in a form would not work out-of-the-box as in .NET there are no built-in data annotation attributes for complex types such as collections.
Regards,
Svetoslav Dimitrov
Progress Telerik