# `FrappeUIPhx.Components.DiceBearAvatar`
[🔗](https://github.com/moacirbishopcamata/frappe_ui_phx/blob/v0.3.1/lib/frappe_ui_phx/components/dice_bear_avatar.ex#L1)

Avatar gerado pelo [DiceBear](https://www.dicebear.com/) a partir de uma `seed`:
a mesma `style` + `seed` + `options` dá sempre o mesmo desenho. Mesmos tamanhos e
formas do `FrappeUIPhx.Components.Avatar`, de quem herda o visual (composição).

    <.dice_bear_avatar seed={@user.public_id} style="thumbs" size={:xl} />
    <.dice_bear_avatar seed={@user.public_id} options={%{backgroundColor: ["b6e3f4"], flip: "horizontal"}} />

A imagem é buscada da API do DiceBear (`FrappeUIPhx.DiceBear`): **a `seed` vai na
URL**. Não passe e-mail nem nome; use `FrappeUIPhx.DiceBear.seed/1` e, se preciso,
hospede a API (`config :frappe_ui_phx, dice_bear_base_url: ...`). A API pública é gratuita só
para uso não comercial e tem limite de requisições; em produção, hospede a sua. Cada estilo tem
licença própria (alguns exigem atribuição). A imagem é
carregada sob demanda e sem enviar o `Referer`. Se a página usa CSP, libere o
host da API em `img-src`.

# `dice_bear_avatar`

## Attributes

* `seed` (`:string`) (required) - identificador estável e não pessoal do avatar.
* `style` (`:string`) - estilo DiceBear (nome como "thumbs" ou "pixel-art"; veja DiceBear.styles/0). Defaults to `"thumbs"`. Must be one of `"blobs"`, `"disco"`, `"glass"`, `"glyphs"`, `"icons"`, `"identicon"`, `"initial-face"`, `"initials"`, `"loops"`, `"patchwork"`, `"rings"`, `"shape-grid"`, `"shapes"`, `"slice"`, `"squircles"`, `"stack"`, `"stripes"`, `"triangles"`, `"waves"`, `"weave"`, `"adventurer"`, `"adventurer-neutral"`, `"avataaars"`, `"avataaars-neutral"`, `"big-ears"`, `"big-ears-neutral"`, `"big-smile"`, `"bottts"`, `"bottts-neutral"`, `"cameo"`, `"clay"`, `"critters"`, `"croodles"`, `"croodles-neutral"`, `"cutouts"`, `"dylan"`, `"fun-emoji"`, `"gaze"`, `"line-face"`, `"lorelei"`, `"lorelei-neutral"`, `"marbles"`, `"micah"`, `"miniavs"`, `"moods"`, `"notionists"`, `"notionists-neutral"`, `"open-peeps"`, `"personas"`, `"pixel-art"`, `"pixel-art-neutral"`, `"pixelbot"`, `"shadows"`, `"sprouts"`, `"thumbs"`, `"toon-head"`, `"voxel-art"`, `"voxel-bot"`, `"constellation"`, `"landscape"`, or `"planets"`.
* `label` (`:string`) - nome acessível (alt) e dica; sem ele a imagem é decorativa. Defaults to `nil`.
* `size` (`:atom`) - Defaults to `:md`. Must be one of `:xs`, `:sm`, `:md`, `:lg`, `:xl`, `:"2xl"`, or `:"3xl"`.
* `shape` (`:atom`) - Defaults to `:circle`. Must be one of `:circle`, or `:square`.
* `image` (`:string`) - foto real do usuário; quando presente ela é exibida no lugar do avatar gerado (placeholder). Defaults to `nil`.
* `flip` (`:string`) - none | horizontal | vertical | both. Defaults to `nil`.
* `rotate` (`:any`) - -360 a 360 graus. Defaults to `nil`.
* `scale` (`:any`) - 0 a 10 (1 = tamanho original). Defaults to `nil`.
* `border_radius` (`:any`) - 0 a 50 (% do canvas; 50 = círculo). Defaults to `nil`.
* `translate_x` (`:any`) - -1000 a 1000 (% da largura). Defaults to `nil`.
* `translate_y` (`:any`) - -1000 a 1000 (% da altura). Defaults to `nil`.
* `background_color` (`:any`) - hex (#RRGGBB), texto ou lista. Defaults to `nil`.
* `tags` (`:any`) - filtro de variantes, ex.: "animation". Defaults to `nil`.
* `options` (`:map`) - outros parâmetros da API, inclusive os do estilo (hairVariant...); listas viram a,b. Os atributos acima têm prioridade. Defaults to `%{}`.
* `base_url` (`:string`) - servidor DiceBear (padrão: config ou API pública). Defaults to `nil`.
* `class` (`:any`) - Defaults to `nil`.
* Global attributes are accepted.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
