Unplanned
Last Updated: 07 Feb 2023 11:28 by ADMIN
Dale
Created on: 24 Jan 2023 21:55
Category: Chip
Type: Feature Request
2
Expose the ability to set an Id

Please expose the ability to set an Id on the Chip and ChipList components.

Example:


<TelerikChip Id="chipid"></TelerikChip>
<TelerikChipList Id="chipid"></TelerikChipList>


3 comments
ADMIN
Svetoslav Dimitrov
Posted on: 07 Feb 2023 11:28

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

Learn about the important changes coming in UI for Blazor 4.0 in January 2023!
Dale
Posted on: 31 Jan 2023 19:33
Correct attaching a label would be what it would be used for. I figure this would be a minor ask since "most" telerik controls  expose this field.
ADMIN
Svetoslav Dimitrov
Posted on: 31 Jan 2023 11:04

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

Learn about the important changes coming in UI for Blazor 4.0 in January 2023!