Hint
Help that is always visible next to a control: what to write and in what format. A Field writes it from hint; on its own, give it an id and point the control at it.
import { Hint } from '@sypnia/ui/react'
From a Field and on its own
We send a POST here each time a row changes.
Every day at 03:00, in the project's time zone.
Code
import { Field, Hint, Input } from '@sypnia/ui/react';
// Usually a Field writes the hint for you. On its own, give it an id and point the control at it.
export default function Hints() {
return (
<div className="sy-stack">
<Field label="Webhook URL" hint="We send a POST here each time a row changes."><Input machine placeholder="https://" /></Field>
<div className="sy-field">
<label className="sy-field__label" htmlFor="cron">Schedule</label>
<Input id="cron" machine defaultValue="0 3 * * *" aria-describedby="cron-hint" />
<Hint id="cron-hint">Every day at 03:00, in the project's time zone.</Hint>
</div>
</div>
);
} When to use it
Use it when
- Formats and limits: «Lowercase, for example orders».
- Consequences: «It cannot be changed later».
Do not use it when
- Repeating the label in other words.
- Long explanations: link to the docs.
For everyone
- Tie it with
aria-describedby, so it is read after the label. - It stays visible while the person writes, unlike a placeholder.
Props
| Hint | Type | Default |
|---|---|---|
id | string |