Skip to content

Hint

Muted helper text for a form field. Inside a Field it joins the control’s aria-describedby and follows the field’s disabled and state. A disabled hint is dimmed whatever its state. Otherwise error, warn, and info each set a color.

<Field class="flex flex-col gap-1">
<Label>Email</Label>
<Input type="email" bind:value />
<Hint>We'll never share your email.</Hint>
</Field>

On its own, associate it with aria-describedby:

<Input id="email" aria-describedby="email-hint" />
<Hint id="email-hint">We'll never share your email.</Hint>

Lowercase letters, numbers, and dashes.

<Hint
  disabled={false}
/>
  • A <p> of helper text that a screen reader announces with the control.
  • Inside a Field it joins the control’s aria-describedby on its own. Several hints stack.
  • Follows the field’s disabled and state, coloring the text for error, warn, and info. disabled wins over all three.

Outside a field, give it an id and name it in the control’s aria-describedby.

Lowercase letters, numbers, and dashes.

Code
Standalone.svelte
<script lang="ts">
import { Hint, Input, Label } from "@viamrobotics/prime-ui";
</script>
<div class="not-content flex max-w-xs flex-col gap-1">
<Label for="standalone-name">Machine name</Label>
<Input id="standalone-name" aria-describedby="standalone-name-hint" placeholder="rover-1" />
<Hint id="standalone-name-hint">Lowercase letters, numbers, and dashes.</Hint>
</div>

States

We'll only use this to send you deploy notifications.

Unavailable while the field is disabled.

That name is already taken.

This name is similar to an existing robot.

Names can be changed later.

In a field

Lowercase letters, numbers, and dashes.

class lands on the <p>, alongside the size and the state color. Two Tailwind text colors on one element resolve by stylesheet order, not class order, so to change the color reliably pass state rather than fighting it.

Takes extraClasses, ...restProps }: Props as its props.