Avatar component for displaying user initials or images in terminal UIs.
npm run tsx:core-gallery
npm run start:core-gallery
Property | Type | Required | Default | Description |
---|---|---|---|---|
src | string | No | - | Image source URL (optional) |
initials | string | No | - | User initials to display (1-3 characters) |
shape | "circle" | "square" | No | - | Avatar shape style |
size | "sm" | "md" | "lg" | No | "md" | Avatar size (from component-schemas.ts) |
BasePropsSchema
and includes all standard TUI component properties:
Property | Type | Default | Description |
---|---|---|---|
parent | blessed.Widgets.Node | - | Parent blessed element |
className | string | - | CSS-like class name for styling |
id | string | - | Unique identifier |
variant | ComponentVariant | "default" | Component variant (primary, secondary, etc.) |
disabled | boolean | false | Whether component is disabled |
hidden | boolean | false | Whether component is hidden |
focusable | boolean | true | Whether component can receive focus |
scrollable | boolean | false | Whether component is scrollable |
Property | Type | Description |
---|---|---|
top | TerminalUnit | Top position |
left | TerminalUnit | Left position |
right | TerminalUnit | Right position |
bottom | TerminalUnit | Bottom position |
width | TerminalUnit | Component width |
height | TerminalUnit | Component height |
padding | PaddingConfig | Internal spacing |
margin | PaddingConfig | External spacing |
Property | Type | Description |
---|---|---|
bg | ColorValue | Background color |
fg | ColorValue | Foreground color |
border | BorderStyle | Border configuration |
borderColor | ColorValue | Border color |
borderStyle | "line" | "double" | "round" | "bold" | "classic" | "none" | Border style helper |
style | TextStyle | Text styling (bold, underline, etc.) |
animation | AnimationType | Animation type |
Method | Parameters | Return Type | Description |
---|---|---|---|
setInitials | initials: string | void | Updates the avatar initials content |
setAvatarSize | size: "sm" | "md" | "lg" | void | Changes avatar size and re-renders |
destroy | - | void | Cleanup method from base component |
Method | Parameters | Return Type | Description |
---|---|---|---|
setVariant | variant: ComponentVariant | void | Updates component variant |
setSize | size: ComponentSize | void | Updates component size |
setState | state: ComponentState | void | Updates component state |
getConfig | - | ComponentConfig | Returns current configuration |
update | props: Partial<AvatarProps> | void | Updates component properties |
Method | Parameters | Return Type | Description |
---|---|---|---|
Avatar.create | props: AvatarProps | Avatar | Factory method to create new avatar instance |