<!--
  GENERATED FILE - do not edit by hand.
  Source of truth: src/components/mds-emoji/ in the magma monorepo (usage/*.md and the
  component's JSDoc). Regenerated on every stencil build (scripts/component-docs.ts).
-->

# mds-emoji

> `@maggioli-design-system/magma` 2.15.0. Shadow DOM: style it only through the public CSS custom properties and the parts below.

The `<mds-emoji>` web component renders one of the Magma Design System's animated mascot illustrations (`mia` or `simi`) as an interactive SVG. It is a decorative, expressive element with no native HTML equivalent: its personality is driven entirely through imperative animation methods rather than markup or props. The illustrations are drawn in the [Magma Emoji](https://www.figma.com/design/09SuDQMZYyOKGyomr87G9c/Emoji?node-id=0-1&t=U3txjHfdwaMIRRAC-1) Figma file.

#### Semantic Behavior

- **Mouse following**: When started, the emoji tracks the pointer with a 3D head rotation and parallax on each facial part; it is off by default and only reacts after `startFollowMouse()` is called. It turns toward the pointer: the direction is the direction of the pointer from the centre of the emoji, and the turn grows with the distance until the pointer is half the short side of the viewport away, the same at every size of the emoji. An emoji placed in a slot its host renders later, or moved in the page, follows the pointer at its usual speed all the same. When the user prefers reduced motion, neither the pointer tracking nor the blinking moves the face, and the expressions (`agree`, `smile`, `disagree`, `startThinking`) show their face - a smile, a frown, the thinking hand - without moving the head or the features, for as long as they would have lasted.
- **Single-animation lock**: Only one expression plays at a time - `agree`, `smile`, `disagree`, and `startThinking` take the face over: each stops whatever is playing (a thinking pose included) and starts from the neutral face, so a later call cuts an earlier one short. `startThinking` is a no-op only while the emoji is already thinking.
- **Promise-based methods**: Every expressive action returns a `Promise<void>` that resolves when its animation finishes, letting callers await one expression before chaining the next.
- **State restoration**: An expression pauses mouse-following and, when it completes, restarts it if it was on: `startFollowMouse()` called and not stopped by a later `stopFollowMouse()`.
- **Idle blinking**: `startBlinking()` runs a random blink loop on the eyes; blinks are suppressed while the emoji is busy with another animation.

#### Properties & Visual Configurations

The only public prop is `name`, which selects the mascot identity. It accepts `'mia'` (the default) or `'simi'`; changing it at runtime swaps the mascot.

#### Other behavioral props

There are no variant, tone, or size props. The expression is configured imperatively through method calls (`agree`, `smile`, `disagree`, `startThinking` / `stopThinking`, `startBlinking` / `stopBlinking`, `startFollowMouse` / `stopFollowMouse`), and the reach of the mouse following is tuned through the public `--mds-emoji-expression-max-rotation` CSS custom property, and Simi's skin tones through `--mds-emoji-simi-skin`, `--mds-emoji-simi-skin-dark` and `--mds-emoji-simi-skin-light`, rather than through attributes.

## Read next

- [`examples.md`](examples.md) - correct usage, from the most common case
- [`mistakes.md`](mistakes.md) - the wrong forms, each with the right one
- [Storybook](https://magma-design-system.github.io/magma/storybook/?path=/docs/ui-emoji--docs) - the live examples, in the published Storybook of `main`
- [`conventions.md`](../../../../agents/conventions.md), [`variants.md`](../../../../agents/variants.md), [`mistakes.md`](../../../../agents/mistakes.md) - the rules shared by every component

## Props

| Prop | Attribute | Type | Default | Description |
| --- | --- | --- | --- | --- |
| `name` | `name` | `"mia" \| "simi"` | `'mia'` | Specifies which emoji to display. |

## Methods

| Method | Signature | Description |
| --- | --- | --- |
| `agree` | `agree() => Promise<void>` | Emoji agrees, useful for confirm actions. |
| `disagree` | `disagree(turnHappyDelay?: number) => Promise<void>` | Emoji disagrees, useful for errors or unwanted results. |
| `smile` | `smile() => Promise<void>` | Emoji smiles, useful for confirm actions. |
| `startBlinking` | `startBlinking() => Promise<void>` | Eyes start blinking. |
| `startFollowMouse` | `startFollowMouse() => Promise<void>` | Starts following mouse with CSS 3D transform. |
| `startThinking` | `startThinking(duration?: number) => Promise<void>` | Emoji starts thinking, useful for pending requests. |
| `stopBlinking` | `stopBlinking() => Promise<void>` | Eyes stop blinking. |
| `stopFollowMouse` | `stopFollowMouse() => Promise<void>` | Stops following mouse with CSS 3D transform. |
| `stopThinking` | `stopThinking(duration?: number) => Promise<void>` | Stops the "thinking" animation after the given duration. |

## CSS custom properties

| Property | Description |
| --- | --- |
| `--mds-emoji-expression-max-rotation` | Sets the maximum rotation angle for the emoji expression |
| `--mds-emoji-simi-skin` | **Static**: a value of its own, not a token or a role. Sets the base color of Simi's skin |
| `--mds-emoji-simi-skin-dark` | **Static**: a value of its own, not a token or a role. Sets the dark shade of Simi's skin |
| `--mds-emoji-simi-skin-light` | **Static**: a value of its own, not a token or a role. Sets the light shade of Simi's skin |

Only these are public. Its other 26 are internal: they may change in any release, do not set them.
