Skip to content

How to embed an icon in an option for a FluentSelect programmatically? #324

Closed Answered by vnbaaij
AndyEdmonds asked this question in Q&A
Discussion options

You must be logged in to vote

Good question. I don't think there is a way to do this yet. Creating a list of <FluentOption>s is not the right way. The warnings you get then are to be expected.

What I could do is add a new Icon property to the Option<> class. The type of the property would be a Tuple with the needed
icon parameters, i.e.:

   public (string Name, IconSize? Size, IconVariant? Variant, Color? Color, string? Slot) Icon { get; set; }

At the place you are generating your Option collection you would then do something like this to add an option with an icon.:

// The 'null' values instruct the code to use the FluentIcon's default values for those parameters
{ new Option<string> { Value = "9", Text = "Nine", Ic…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@adeyinkaroyal
Comment options

@vnbaaij
Comment options

Answer selected by AndyEdmonds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants