-
I am trying to show a No matter what I try, I get the same result. I also noticed this happened in the docs when you had a trailing icon in a select list. If I fix the width of the label at 150px, it looks like I want, but I am sure I'll run into this again with other things. What am I missing? As always, TIA. Here's the code: <FluentSelect TOption="Option<Palette>"
Items="@PaletteOptions"
Width="350px"
OptionValue="@(i => i.Text)"
Placeholder="Need help? Use a palette.">
<OptionTemplate>
<FluentStack Orientation="Orientation.Horizontal"
VerticalAlignment="VerticalAlignment.Center"
HorizontalAlignment="HorizontalAlignment.SpaceBetween">
<FluentLabel
Alignment="HorizontalAlignment.Start">@context.Text
</FluentLabel>
<FluentStack Orientation="Orientation.Horizontal"
HorizontalGap="0"
HorizontalAlignment="HorizontalAlignment.End">
@foreach (var color in @context.Value.ColorsList)
{
<div
style="width: 32px; height: 24px; background-color: @color; border-radius: 0px; margin: 1px;">
</div>
}
</FluentStack>
</FluentStack>
</OptionTemplate>
</FluentSelect> |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 6 replies
-
This is how we do it in the demo site (site settings panel):
Which then looks like: As your code is not runnable for us, it is not possible to tinker with it. Please include ready to run code... I would try to just have a div around the color blocks instead of putting them in a stack again. And I don't think you need the alignment on the label |
Beta Was this translation helpful? Give feedback.
-
Converting this to a discussion item as it is not really an issue with the library |
Beta Was this translation helpful? Give feedback.
-
Thanks, @vnbaaij. In your example, the first element is a fixed width. That's why it works with your code. But... You pointed me in the correct direction. In my little brain, I believe in order for space-between to work, the parent container has to know how wide it is. So I changed the code like the code below, wrapping the inner FluentStack in a fixed width div and it works as expected. There may be a better way, but this first attempt is a start. I'd love for it to be only was wide as it needs to be, but I'm not there, yet. Thanks, again. <OptionTemplate>
<div style="width: 350px;">
<FluentStack Orientation="Orientation.Horizontal"
VerticalAlignment="VerticalAlignment.Center"
HorizontalAlignment="HorizontalAlignment.SpaceBetween">
<FluentLabel
Alignment="HorizontalAlignment.Start">@context.Text
</FluentLabel>
<FluentStack Orientation="Orientation.Horizontal"
HorizontalGap="0"
HorizontalAlignment="HorizontalAlignment.End">
@foreach (var color in @context.Value.ColorsList)
{
<div
style="width: 24px; height: 24px; background-color: @color; border-radius: 0px; margin: 1px;">
</div>
}
</FluentStack>
</FluentStack>
</div>
</OptionTemplate> |
Beta Was this translation helpful? Give feedback.
-
And this might be a different discussion, but it's related. How can I show a color palette in the select when it's collapsed. I only seem to be able to put text in there. |
Beta Was this translation helpful? Give feedback.
It is always just text as far as I know