Bubble
A chat message in a bubble that shows who sent it.
Left out of Content first Readers need sections, navigation and little else. Bubbles are for back-and-forth chat, and the catalogue rules them out for long text. Use instead: Card
See it live
npm run storybookWhen to use it
- 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
- Write to one person: "you", not "users".
- Short sentences with room to breathe.
- Explain why before asking for anything.
- Use: Read, Save for later, You, Next issue. Avoid: Click here, Submit, Users, Content.
The labels components use, from the voice tokens:
content.action.commit: Savecontent.action.cancel: Not nowcontent.action.destroy: Removecontent.action.retry: Try againcontent.action.empty-action: Browse guides
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.
Content 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) | Lightstone.light.100:#F6F2EADarkstone.dark.100:#2E2A24 |
| Text Changes with theme | component.bubble.them.labelcolor.text.primaryvar(--bubble-them-label) | Lightstone.light.900:#1F1B16Darkstone.dark.900:#FFFDF8 |
| Me | ||
| Fill Changes with theme | component.bubble.me.backgroundcolor.action.primaryvar(--bubble-me-background) | Lightnavy.light.600:#1E3A5FDarknavy.dark.600:#8FA6C4 |
| Text Changes with theme | component.bubble.me.labelcolor.text.on-actionvar(--bubble-me-label) | Lightstone.light.0:#FFFFFFDarkstone.light.900:#1F1B16 |
| Bubble | ||
| Gap | component.bubble.gapspace.gap.tightvar(--bubble-gap) | space.8:0.5rem |
| Text size | component.bubble.font-sizetype.caption.font-sizevar(--bubble-font-size) | font.size.14:0.875rem |
| Text Changes with theme | component.bubble.labelcolor.text.mutedvar(--bubble-label) | Lightstone.light.600:#61594DDarkstone.dark.400:#A39A8B |
| Body | ||
| Corner | component.bubble.body.radiusradius.containervar(--bubble-body-radius) | radius.12:0.75rem |
| 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.18:1.125rem |