UI components · Composed · new in 0.7
SpAvatar · SpAvatarGroup
Live
Drawn here with the Reflex version, sp_avatar · sp_avatar_group, on the ground you pick:
Code
The same example in each framework; pick one once and every example on the site follows it.
import { SpAvatar, SpAvatarGroup } from '@silverpoint/react/ui/avatar';
<SpAvatar name="Ernesto Crespo" size="lg" /> {/* initials when there is no src */}
<SpAvatar name="Leonardo da Vinci" shape="square" />
<SpAvatar src="/portrait.png" name="Anna Atkins" />
<SpAvatarGroup label="Draughtsmen">
<SpAvatar name="Albrecht Dürer" size="sm" />
<SpAvatar name="Raphael Sanzio" size="sm" />
</SpAvatarGroup><script setup lang="ts">
import { SpAvatar, SpAvatarGroup } from '@silverpoint/vue/ui/avatar';
</script>
<template>
<SpAvatar name="Ernesto Crespo" size="lg" />
<SpAvatar name="Leonardo da Vinci" shape="square" />
<SpAvatarGroup label="Draughtsmen">
<SpAvatar name="Albrecht Dürer" size="sm" />
<SpAvatar name="Raphael Sanzio" size="sm" />
</SpAvatarGroup>
</template>import { Component } from '@angular/core';
import { SpAvatar, SpAvatarGroup } from '@silverpoint/angular/ui/avatar';
@Component({
selector: 'app-people',
imports: [SpAvatar, SpAvatarGroup],
template: `
<sp-avatar name="Ernesto Crespo" size="lg" />
<sp-avatar name="Leonardo da Vinci" shape="square" />
<sp-avatar-group label="Draughtsmen">
<sp-avatar name="Albrecht Dürer" size="sm" />
<sp-avatar name="Raphael Sanzio" size="sm" />
</sp-avatar-group>
`,
})
export class People {}sp_avatar(name="Ernesto Crespo", size="lg") # initials when there is no src
sp_avatar(name="Leonardo da Vinci", shape="square")
sp_avatar(src="/portrait.png", name="Anna Atkins")
sp_avatar_group(
sp_avatar(name="Albrecht Dürer", size="sm"),
sp_avatar(name="Raphael Sanzio", size="sm"),
label="Draughtsmen",
)Import
Import @silverpoint/grounds/ui.css once, beside styles.css; Reflex adds it for you. Every adapter also exports it from the ui barrel.
| Framework | Import |
|---|---|
| React | import { SpAvatar, SpAvatarGroup } from '@silverpoint/react/ui/avatar'; |
| Vue | import { SpAvatar, SpAvatarGroup } from '@silverpoint/vue/ui/avatar'; |
| Angular | import { SpAvatar, SpAvatarGroup } from '@silverpoint/angular/ui/avatar'; · sp-avatar · sp-avatar-group |
| Reflex | from reflex_silverpoint_react import sp_avatar, sp_avatar_group |
Events, values and slots
Each framework's own way. A change carries the new value itself (a key, a page, a number, a bool), never a DOM event.
| React | Vue | Angular | Reflex | |
|---|---|---|---|---|
| Group | <SpAvatarGroup> children | default slot | projected sp-avatar | sp_avatar_group(*avatars) |
Props
SpAvatar
| React / Angular | Vue | Type | Description |
|---|---|---|---|
src | src | string | An image; the initials are drawn without one. |
name | name | string | The person's name: the accessible name and the source of the initials. |
initials | initials | string | Overrides the initials derived from name. |
alt | alt | string | Overrides name as the accessible name. |
shape | shape | 'circle' | 'square' | Default 'circle'. |
pixelSize | pixel-size | number | Side length in px; the ground's control height when omitted. |
SpAvatarGroup
| React / Angular | Vue | Type | Description |
|---|---|---|---|
label | label | string | — |
In Reflex the names are snake_case; the Reflex column of Composed components shows the builder's arguments.
Common props
Every UI component also takes these, falling back to the dashboard it sits in, then to the provider. In Reflex they read silverpoint_provider too; only sp_trigger does not: pass them to it.
| React / Angular | Vue | Reflex | Type | Description |
|---|---|---|---|---|
id | id | id | str | The frame variant and every related id derive from it. |
ground | ground | ground | Literal['silverpoint', 'cyanotype'] | str | dict[str, Any] | Style ground: "silverpoint" or "cyanotype", or a ground object. Defaults to the dashboard's, then the provider's, or silverpoint. |
substrate | substrate | substrate | Literal['cream', 'green', 'blue', 'ochre', 'prussian'] | Prepared substrate within the ground. |
mode | mode | mode | Literal['ink', 'precision'] | ink by default; precision disables inking. |
seed | seed | seed | str | int | Seed of the frame's hand; overrides id for the frame variant only. |
size | size | size | Literal['sm', 'md', 'lg'] | Control size: sm, md (default) or lg. |
palette | palette | palette | dict[str, str] | Colours over the ground's (set with palette=), merged over the dashboard's and the provider's. |
className | class-name | class_name | str | Added to the component's root element, after its own classes. |
palette | palette | palette | Palette | Colours over the ground's, merged over the dashboard's and the provider's. |