Skip to content

SusRating

SusRating

Star (or custom icon) rating — whole or half increments.

Package

SusKit · Atoms (commercial)

Open in Playground

SusKit · Atoms

Props

NameTypeDefault
ValueProp<float>0v-model
MaxProp<int>5v-model
ColorProp<string>"warning"v-model
EmptyIconProp<string>"star"v-model
FullIconProp<string>"star-fill"v-model
HalfIconProp<string>"star-half"v-model
HalfIncrementsProp<bool>falsev-model
HoverProp<bool>falsev-model
ReadonlyProp<bool>falsev-model
SizeProp<string>"md"v-model
ClearableProp<bool>falsev-model

Slots

No slots.

Events

NameFieldPayload
ValueChangedOnValueChangedfloat

Style hooks

USS class contract — override appearance without touching C#. States toggle via these classes:

  • sus-rating
  • sus-rating__star
  • sus-rating__star-empty
  • sus-rating__star-fill-clip
  • sus-rating__star-full
  • sus-rating--danger
  • sus-rating--hover
  • sus-rating--info
  • sus-rating--primary
  • sus-rating--readonly
  • sus-rating--secondary
  • sus-rating--size-lg
  • sus-rating--size-sm
  • sus-rating--size-xl
  • sus-rating--success
  • sus-rating--warning

Usage

xml
<template>
  <sus:SusRating :Value="Score.Value"
                 Max="5"
                 Color="warning"
                 HalfIncrements="true"
                 Hover="true"
                 @value-changed="OnScore" />
</template>

<script>
public Prop<float> Score = new(3.5f);
void OnScore(float value) { /* … */ }
</script>
csharp
var rating = new SusRating();
rating.Value.Value = 4f;
rating.Max.Value = 5;
rating.Color.Value = "warning";
rating.Clearable.Value = true;
rating.OnValueChanged += value => { /* … */ };

Notes

  • Override icons with EmptyIcon / FullIcon / HalfIcon (Phosphor names).
  • Readonly for display-only scores; Hover previews the value under the pointer.