Skip to content
tcpsystemsui

Theme

Colour scheme
Accent
Density
Radius
Esc

Rating

Lets users choose a rating from a radio group, or shows a read-only rating value.

beta

Try it

Deployment experience
Svelte
<Rating label="Deployment experience" name="playground-deployment-rating" value={3} />

Examples

Deployment feedback

How was this deployment?

Choose a score.

Deployment feedback.svelte
<script lang="ts">
	import Rating from '@tcpsystems/ui/foundation/Rating';
	const uid = $props.id();
	let score = $state(0);
</script>

<form onchange={(event) => score = Number((event.target as HTMLInputElement).value)}>
	<Rating label="How was this deployment?" name={uid} value={score} />
	<p>{score ? `Your score: ${score} of 5` : 'Choose a score.'}</p>
</form>

Readonly

4 of 5
0 of 5
Readonly.svelte
<script lang="ts">
	import Rating from '@tcpsystems/ui/foundation/Rating';
	import Stack from '@tcpsystems/ui/foundation/Stack';
	const uid = $props.id();
</script>

<Stack>
	<Rating label="Team satisfaction" name={`${uid}-team`} value={4} readonly />
	<Rating label="No reviews yet" name={`${uid}-empty`} value={0} readonly />
</Stack>

Ten point scale

How likely are you to recommend Studio?
Ten point scale.svelte
<script lang="ts">
	import Rating from '@tcpsystems/ui/foundation/Rating';
	const uid = $props.id();
	let score = $state(8);
</script>

<form onchange={(event) => score = Number((event.target as HTMLInputElement).value)}>
	<Rating label="How likely are you to recommend Studio?" name={uid} max={10} value={score} />
</form>

API

Import
import Rating from '@tcpsystems/ui/foundation/Rating';
PropTypeDefault
labelstringnone
namestringnone
max?number5
value?numbernone
readonly?booleanfalse
HookKind
.tcp-ratingRoot class
data-filledData attribute