Bubble
A chat message in a bubble that shows who sent it.
In Accessible first
See it live
npm run storybookWhen to use it
In Accessible first: A back-and-forth conversation, in large text with strong contrast. Not for comments or long text.
- Use it when: A back-and-forth conversation between people or with an assistant.
- Not when: Comments on a page or long text (use a message or a card).
Instead:
- Message: One message with its author and time, without the bubble shape.
Words
- Use common words. Explain any term you must use.
- One idea per sentence. Put the action first.
- Never blame the person.
- Use: Continue, Change, Start, You. Avoid: Invalid, Utilise, Submit, Error code.
The labels components use, from the voice tokens:
content.action.commit: Continuecontent.action.cancel: Go backcontent.action.destroy: Deletecontent.action.retry: Try againcontent.action.empty-action: Start a new application
See Voice and tone for the whole voice.
Use it in code
npx open-ds add bubble
The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.
Tokens it reads
Bubble reads 11 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Bubble's tokens to change Bubble alone.
Accessible first decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.
| Part | Its token and the semantic it aliases | Value |
|---|---|---|
| Them | ||
| Fill Changes with theme | component.bubble.them.backgroundcolor.surface.sunkenvar(--bubble-them-background) | Lightgray.light.100:#EDEDEDDarkgray.dark.100:#222222 |
| Text Changes with theme | component.bubble.them.labelcolor.text.primaryvar(--bubble-them-label) | Lightgray.light.900:#141414Darkgray.dark.900:#F7F7F7 |
| Me | ||
| Fill Changes with theme | component.bubble.me.backgroundcolor.action.primaryvar(--bubble-me-background) | Lightblue.light.600:#0B4FC0Darkblue.dark.600:#8AB4F8 |
| Text Changes with theme | component.bubble.me.labelcolor.text.on-actionvar(--bubble-me-label) | Lightgray.light.0:#FFFFFFDarkgray.light.900:#141414 |
| Bubble | ||
| Gap | component.bubble.gapspace.gap.tightvar(--bubble-gap) | space.12:0.75rem |
| Text size | component.bubble.font-sizetype.caption.font-sizevar(--bubble-font-size) | font.size.16:1rem |
| Text Changes with theme | component.bubble.labelcolor.text.mutedvar(--bubble-label) | Lightgray.light.500:#595959Darkgray.dark.500:#949494 |
| Body | ||
| Corner | component.bubble.body.radiusradius.containervar(--bubble-body-radius) | radius.8:0.5rem |
| Padding, left and right | component.bubble.body.padding-xcomponent-spacing-map.x3var(--bubble-body-padding-x) | space.20:1.25rem |
| Padding, top and bottom | component.bubble.body.padding-ycomponent-spacing-map.x2var(--bubble-body-padding-y) | space.8:0.5rem |
| Text size | component.bubble.body.font-sizetype.body.font-sizevar(--bubble-body-font-size) | font.size.19:1.1875rem |