ConfidenceIndicator
StableThree bars and a label that show how sure the assistant is about an answer.
Also known as confidence score, certainty, uncertainty indicator
Install with npm install @tattva/ui (setup), or copy the code from the kit in Downloads.
All levels
<div className="flex flex-col items-start gap-3">
<ConfidenceIndicator level="low" />
<ConfidenceIndicator level="medium" />
<ConfidenceIndicator level="high" />
</div>Low fills one bar, medium two and high three.
When to use it
Tells people how far to trust an answer. Bars, a word and a sentence all say the same thing, so nobody needs to see color to read it.
Made of: Bars · Label · Hidden explanation (for screen readers)
Use it for
- Beside a reply or fact that is not always reliable.
- Next to an extracted value that a person may need to check.
Do and avoid
Do
- Show it near the answer it describes, like at the bottom of a message.
- Base the level on something real: how well the sources support the answer, how much of the question was covered, or a success rate you measured on real cases. Write down what each level means for your product.
- When confidence is low, suggest a next step, like checking sources.
- Leave it out when you have no real signal. No label is better than one that guesses.
Avoid
- Do not drive it from the model's own rating of itself ("I am 90% sure"). Models are often sure and wrong.
- Do not show a percentage you have not measured; a number looks more exact than it is.
- Do not put it on every answer as decoration.
- Do not drop the words to save space. They are the main clue.
- Do not add levels beyond low, medium and high.
On a phone
- It stays on one line: bars, then the badge.
- The longer sentence, such as "Verify before relying on this", is only a hover tooltip and a screen reader line, so on a phone the bars and the badge word carry the meaning.
- The badge text is at least 12px on touch screens.
Properties
| Prop | Type | Default | Description |
|---|---|---|---|
| levelrequired | "low" | "medium" | "high" | none | Confidence level. Controls the bars, the badge tone and the label. |
| showText | boolean | true | Includes a visually hidden sentence that explains the level, for example Low confidence. Verify before relying on this. |
"Show code under the preview gives the code for the example on the stage."
In Figma
In Figma, one ConfidenceIndicator switches all of this from its properties panel, across 3 variants. Each property sets the React prop beside it, so design and code use the same names.
| Figma property | React | Values |
|---|---|---|
| Level | level | Low, Medium, High |
States
States this part has beyond its default look. Build each one your screen can reach. States set by a property are in the Code tab.
- low
- Set level to low for one bar, a warning badge and a verify-before-relying note.
- medium
- Set level to medium for two bars and a neutral badge.
- high
- Set level to high for three bars and a success badge.
Tokens
Change one of these and every part that uses it follows.
--attention--attention-soft--attention-fg--success--success-soft--fg-subtle--border-strong
Built in
- The bars are hidden from screen readers. They read the label, such as "High confidence".
- A hidden sentence explains the level, such as "Low confidence. Verify before relying on this." Setting showText to false removes it.
- The same sentence shows as a tooltip on hover.
- The bars' grow-in motion stops when people turn off motion in their system settings.
What you need to do
- Keep showText on unless the same explanation is already written nearby.
- Place it right next to the answer it rates, so it is clear what it refers to.
Built toward WCAG 2.2 AA and checked automatically; no independent audit yet. Read the accessibility guide