Theme
Rating
Star rating input with half-star support
Start Here
Start from the smallest working snippet, then move to interactive examples and the full API contract below.
Styled quick start
Copy this entrypoint first. It includes the imports required to get the component on screen.
svelte
<script lang="ts">
import '@dryui/ui/themes/default.css';
import '@dryui/ui/themes/dark.css';
import { Rating } from '@dryui/ui';
</script>
<Rating bind:value={score} />Import options
Root package
ts
import { Rating } from '@dryui/ui'Per-component subpath
ts
import { Rating } from '@dryui/ui/rating'Customize
Use the interactive examples to see common variants, states, and composition patterns before building your own.
Default
svelte
<Rating />With Value
svelte
<Rating value={3} />Readonly
svelte
<Rating value={4} readonly />Half Stars
svelte
<Rating value={3.5} allowHalf readonly />Sizes
Interactive
Rating: 0 / 5
svelte
<script lang="ts">
let userRating = $state(0);
</script>
<Rating onValueChange={(v) => { userRating = v; }} />
<p>Rating: {userRating} / 5</p>Compose
The full API contract lives here: props, CSS variables, and the public data attributes you can target when styling.
| Prop | Type | Default | Required | Bindable |
|---|---|---|---|---|
value | number | 0 | — | ✓ |
max | number | — | — | — |
disabled | boolean | — | — | — |
readonly | boolean | — | — | — |
allowHalf | boolean | — | — | — |
onValueChange | (value: number) => void | — | — | — |
size | smmdlg | 'md' | — | — |
Forwards <div> attributes via rest props. Common examples: id, style, role.