Stars to pick and show a rating.

New control
InteractiveRating demo
<gpui:Rating Value="3" HorizontalAlignment="Left" />

Usage

gpui:Rating is a row of Maximum stars (5 by default) with Value of them filled, in the theme's yellow or ActiveBrush. The pointer previews the value under it; a click sets Value to that star, or to the star before when that star is already filled, so a rating can be cleared down to zero. Value binds two-way by default. A disabled rating shows its value only. Each star is a gpui:RatingStar with the :filled and :active pseudo-classes.

ClassStar icon
xsmall12px
small14px
(medium)16px
large24px

Examples

The four sizes.

Sizes
InteractiveRating demo: Sizes
<StackPanel Spacing="8" HorizontalAlignment="Left">
  <gpui:Rating Classes="xsmall" Value="3" />
  <gpui:Rating Classes="small" Value="3" />
  <gpui:Rating Value="3" />
  <gpui:Rating Classes="large" Value="3" />
</StackPanel>

Maximum sets the number of stars.

Maximum
InteractiveRating demo: Maximum
<StackPanel Spacing="8" HorizontalAlignment="Left">
  <gpui:Rating Value="2" Maximum="3" />
  <gpui:Rating Value="7" Maximum="10" />
</StackPanel>

ActiveBrush colors the filled and previewed stars; the theme's Gpui.Red and Gpui.Primary here.

Color
InteractiveRating demo: Color
<StackPanel Spacing="8" HorizontalAlignment="Left">
  <gpui:Rating Value="4" ActiveBrush="{DynamicResource Gpui.Red}" />
  <gpui:Rating Value="4" ActiveBrush="{DynamicResource Gpui.Primary}" />
</StackPanel>

A disabled rating neither previews nor changes.

Disabled
InteractiveRating demo: Disabled
<gpui:Rating Value="3" IsEnabled="False" HorizontalAlignment="Left" />

Not covered

  • Nothing: the control covers the component.