Star rating with a note
Five stars that fill up to the one you pick and name the score in words, then one optional note. For a review after a job or an order.
The code
Plain HTML and CSS on your kit's variables. Put it next to tokens/variables.css from your kit's files and it draws in your look.
<div class="ukc-form-star-review">
<form class="rv" action="#" aria-labelledby="ukc-form-star-review-title">
<p class="kicker">Tern Cycle Works, job 3318</p>
<h3 id="ukc-form-star-review-title">How was the tune-up?</h3>
<p class="lead">Brake bleed and a new chain on the grey Kestrel, collected on Tuesday.</p>
<fieldset class="rate">
<legend class="sr">Your rating</legend>
<div class="stars"><label><input type="radio" name="ukc-form-star-review-stars" value="1"><span class="sr">1 of 5, not good</span><svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3.5l2.6 5.5 6 .7-4.4 4.1 1.2 5.9L12 16.8 6.6 19.7l1.2-5.9L3.4 9.7l6-.7z"/></svg></label><label><input type="radio" name="ukc-form-star-review-stars" value="2"><span class="sr">2 of 5, could be better</span><svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3.5l2.6 5.5 6 .7-4.4 4.1 1.2 5.9L12 16.8 6.6 19.7l1.2-5.9L3.4 9.7l6-.7z"/></svg></label><label><input type="radio" name="ukc-form-star-review-stars" value="3"><span class="sr">3 of 5, fine</span><svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3.5l2.6 5.5 6 .7-4.4 4.1 1.2 5.9L12 16.8 6.6 19.7l1.2-5.9L3.4 9.7l6-.7z"/></svg></label><label><input type="radio" name="ukc-form-star-review-stars" value="4" checked><span class="sr">4 of 5, good</span><svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3.5l2.6 5.5 6 .7-4.4 4.1 1.2 5.9L12 16.8 6.6 19.7l1.2-5.9L3.4 9.7l6-.7z"/></svg></label><label><input type="radio" name="ukc-form-star-review-stars" value="5"><span class="sr">5 of 5, spot on</span><svg width="32" height="32" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 3.5l2.6 5.5 6 .7-4.4 4.1 1.2 5.9L12 16.8 6.6 19.7l1.2-5.9L3.4 9.7l6-.7z"/></svg></label></div>
<p class="word" aria-hidden="true"><span class="w0">Pick a star</span><span class="w1"><b>1 of 5</b>Not good</span><span class="w2"><b>2 of 5</b>Could be better</span><span class="w3"><b>3 of 5</b>Fine</span><span class="w4"><b>4 of 5</b>Good</span><span class="w5"><b>5 of 5</b>Spot on</span></p>
</fieldset>
<div class="f">
<label for="ukc-form-star-review-note">What should we keep doing, or fix? <span class="optional">Optional</span></label>
<textarea id="ukc-form-star-review-note" rows="3">Shifting is crisp again. A text when it was ready would have saved me a trip.</textarea>
</div>
<label class="chk"><input type="checkbox" name="ukc-form-star-review-name" checked>Show my first name next to this review</label>
<div class="act"><button class="go" type="submit">Post review</button><button class="ghost" type="button">Not now</button></div>
</form>
</div>
.ukc-form-star-review { position: relative; font-family: var(--uk-font-body, system-ui, sans-serif); color: var(--uk-ink); font-size: 15px; line-height: 1.5;
--tint: color-mix(in srgb, var(--uk-accent) 12%, var(--uk-paper));
--tint-strong: color-mix(in srgb, var(--uk-accent) 22%, var(--uk-paper));
--accent-deep: color-mix(in srgb, var(--uk-accent) 72%, black);
--ink-soft: color-mix(in srgb, var(--uk-ink) 8%, var(--uk-paper));
--line-strong: color-mix(in srgb, var(--uk-ink) 32%, var(--uk-paper));
--danger-tint: color-mix(in srgb, var(--uk-danger) 12%, var(--uk-paper));
--high-tint: color-mix(in srgb, var(--uk-highlight) 28%, var(--uk-paper)); }
.ukc-form-star-review *, .ukc-form-star-review *::before, .ukc-form-star-review *::after { box-sizing: border-box; }
.ukc-form-star-review :where(h1, h2, h3, h4, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; }
.ukc-form-star-review :where(ul, ol) { padding: 0; list-style: none; }
.ukc-form-star-review :where(button, input, select, textarea) { font: inherit; color: inherit; }
.ukc-form-star-review :where(a) { color: inherit; }
.ukc-form-star-review svg { flex: none; }
.ukc-form-star-review .sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.ukc-form-star-review .f { display: grid; gap: 6px; min-width: 0; align-content: start; }
.ukc-form-star-review .f > label, .ukc-form-star-review .lbl { font-size: 14px; font-weight: 600; line-height: 1.35; }
.ukc-form-star-review .hint { font-size: 13px; line-height: 1.45; color: var(--uk-muted); }
.ukc-form-star-review .optional { font-weight: 400; color: var(--uk-muted); }
.ukc-form-star-review :where(input:not([type="checkbox"], [type="radio"]), select, textarea) { inline-size: 100%; min-width: 0; height: 42px; margin: 0; padding: 0 12px; border: var(--uk-border-width) solid var(--line-strong); border-radius: var(--uk-radius-md); background: var(--uk-paper); font-size: 15px; line-height: 1.3; transition: border-color var(--uk-motion-duration) var(--uk-motion-ease), box-shadow var(--uk-motion-duration) var(--uk-motion-ease); }
.ukc-form-star-review textarea { height: auto; min-height: 76px; padding: 10px 12px; border-radius: min(var(--uk-radius-md), 10px); resize: vertical; line-height: 1.45; }
.ukc-form-star-review ::placeholder { color: color-mix(in srgb, var(--uk-muted) 72%, var(--uk-paper)); opacity: 1; }
.ukc-form-star-review :where(input, select, textarea):focus-visible { outline: none; border-color: var(--uk-accent); box-shadow: 0 0 0 3px var(--tint-strong); }
.ukc-form-star-review .pick { position: relative; display: block; min-width: 0; }
.ukc-form-star-review .pick select { appearance: none; padding-right: 36px; cursor: pointer; }
.ukc-form-star-review .pick::after { content: ""; position: absolute; right: 15px; top: 50%; width: 7px; height: 7px; border: solid var(--uk-muted); border-width: 0 2px 2px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.ukc-form-star-review [aria-invalid="true"] { border-color: var(--uk-danger); }
.ukc-form-star-review [aria-invalid="true"]:focus-visible { border-color: var(--uk-danger); box-shadow: 0 0 0 3px var(--danger-tint); }
.ukc-form-star-review .err { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; font-weight: 600; line-height: 1.4; color: var(--uk-danger); }
.ukc-form-star-review .err svg { margin-top: 1px; }
.ukc-form-star-review .chk input { appearance: none; flex: none; inline-size: 18px; block-size: 18px; margin: 1px 0 0; display: inline-grid; place-content: center; border: var(--uk-border-width) solid var(--line-strong); border-radius: min(var(--uk-radius-sm), 5px); background: var(--uk-paper); cursor: pointer; transition: background-color var(--uk-motion-duration) var(--uk-motion-ease), border-color var(--uk-motion-duration) var(--uk-motion-ease); }
.ukc-form-star-review .chk input::before { content: ""; inline-size: 10px; block-size: 5px; margin-top: -3px; border: solid var(--uk-accent-ink); border-width: 0 0 2px 2px; transform: rotate(-45deg) scale(0); transition: transform var(--uk-motion-duration) var(--uk-motion-ease); }
.ukc-form-star-review .chk input:checked { border-color: var(--uk-accent); background: var(--uk-accent); }
.ukc-form-star-review .chk input:checked::before { transform: rotate(-45deg) scale(1); }
.ukc-form-star-review .chk input:focus-visible { outline: 2px solid var(--uk-accent); outline-offset: 2px; }
.ukc-form-star-review .go, .ukc-form-star-review .ghost { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 20px; border-radius: var(--uk-radius-md); font-size: 15px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; transition: background-color var(--uk-motion-duration) var(--uk-motion-ease), border-color var(--uk-motion-duration) var(--uk-motion-ease); }
.ukc-form-star-review .go { border: var(--uk-border-width) solid var(--uk-accent); background: var(--uk-accent); color: var(--uk-accent-ink); }
.ukc-form-star-review .go:hover { border-color: var(--accent-deep); background: var(--accent-deep); }
.ukc-form-star-review .ghost { border: var(--uk-border-width) solid var(--line-strong); background: none; color: var(--uk-ink); }
.ukc-form-star-review .ghost:hover { background: var(--ink-soft); }
.ukc-form-star-review :where(button, a, summary):focus-visible { outline: 2px solid var(--uk-accent); outline-offset: 2px; }
.ukc-form-star-review .kicker { font: 500 11px/1.3 var(--uk-font-mono, ui-monospace, monospace); letter-spacing: 0.12em; text-transform: uppercase; color: var(--uk-muted); }
.ukc-form-star-review .rv { max-width: 440px; display: grid; gap: 16px; }
.ukc-form-star-review h3 { margin-top: -8px; font-family: var(--uk-font-display, inherit); font-size: 27px; font-weight: 600; line-height: 1.1; }
.ukc-form-star-review .lead { margin-top: -10px; font-size: 14px; color: var(--uk-muted); }
.ukc-form-star-review .rate { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 14px 0; border: 0; border-block: var(--uk-border-width) solid var(--uk-line); }
.ukc-form-star-review .stars { display: flex; margin-left: -5px; }
.ukc-form-star-review .stars label { position: relative; display: grid; padding: 5px; border-radius: min(var(--uk-radius-sm), 8px); color: var(--line-strong); cursor: pointer; }
.ukc-form-star-review .stars input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; }
.ukc-form-star-review .stars svg { stroke-width: 1.5; transition: scale var(--uk-motion-duration) var(--uk-motion-ease); }
.ukc-form-star-review .stars label:hover svg { scale: 1.12; }
.ukc-form-star-review .stars label:has(input:checked), .ukc-form-star-review .stars label:has(~ label input:checked) { color: var(--uk-accent); }
.ukc-form-star-review .stars label:has(input:checked) svg, .ukc-form-star-review .stars label:has(~ label input:checked) svg { fill: currentColor; }
.ukc-form-star-review .stars label:has(input:focus-visible) { outline: 2px solid var(--uk-accent); outline-offset: 1px; }
.ukc-form-star-review .word { min-height: 22px; font-size: 15px; font-weight: 600; }
.ukc-form-star-review .word span { display: none; }
.ukc-form-star-review .word b { margin-right: 8px; font: 500 12px var(--uk-font-mono, ui-monospace, monospace); color: var(--uk-muted); }
.ukc-form-star-review .rate:not(:has(input:checked)) .w0 { display: inline; font-weight: 400; color: var(--uk-muted); }
.ukc-form-star-review .rate:has(input[value="1"]:checked) .w1 { display: inline; }
.ukc-form-star-review .rate:has(input[value="2"]:checked) .w2 { display: inline; }
.ukc-form-star-review .rate:has(input[value="3"]:checked) .w3 { display: inline; }
.ukc-form-star-review .rate:has(input[value="4"]:checked) .w4 { display: inline; }
.ukc-form-star-review .rate:has(input[value="5"]:checked) .w5 { display: inline; }
.ukc-form-star-review .chk { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.ukc-form-star-review .act { display: flex; flex-wrap: wrap; gap: 10px; }