user
Bundled portrait; no remote image request is needed.
variant="user"
WelkUI!REACT EDITIONExplore live variants, compare states, and learn every prop. Pick a component to start.
A compact portrait with a comic outline. Supply a custom src or icon, or choose a bundled portrait. The alt text supplies its accessible name. Custom image loading uses native browser behavior without an automatic fallback.
import { WelkAvatar } from "@welkui/react";
<WelkAvatar variant="female-admin" alt="Mission leader" size="lg" />Import @welkui/react/styles.css once in your app. Stateful snippets belong inside a React component.
These are real components, not screenshots. Compare their appearance and try the controls. Key props below each preview show what changes; use the usage example above for imports and component setup.
Bundled portrait; no remote image request is needed.
variant="user"Bundled portrait; no remote image request is needed.
variant="male-user"Bundled portrait; no remote image request is needed.
variant="female-user"Bundled portrait; no remote image request is needed.
variant="male-admin"Bundled portrait; no remote image request is needed.
variant="female-admin"Choose a size appropriate to lists, headers, or profile summaries.
size="sm"Choose a size appropriate to lists, headers, or profile summaries.
size="md"Choose a size appropriate to lists, headers, or profile summaries.
size="lg"A src overrides bundled artwork. Hover to enlarge.
src={superman} growOnHoverAn icon can replace the portrait when src is omitted.
icon={<span>W</span>} color="#82caff"Required props are marked in the default column. Other props are optional. ReactNode accepts text or JSX.
| Prop | Type | Default | Description |
|---|---|---|---|
alt | string | Required | Accessible description of the avatar. |
src | string | Unset | Custom image URL; takes precedence over icon and bundled artwork. |
icon | ReactNode | Unset | Custom content instead of the bundled portrait. |
variant | "user" | "male-user" | "female-user" | "male-admin" | "female-admin" | "user" | Bundled portrait selection. |
size | "sm" | "md" | "lg" | "md" | Small, medium, or large presentation. |
color | CSSProperties["backgroundColor"] | Theme color | Custom avatar background color. |
growOnHover | boolean | false | Enables hover enlargement. |
Inherits native span attributes except children and color; forwards a span ref.
Import @welkui/react/styles.css once in your app entry or Next.js root layout. The previews use the default theme; override --welk-* CSS tokens in your app to customize it.
For Next.js, put hooks and event handlers in a component beginning with "use client". Keep state local to the component using the control. The library preserves its client boundaries and uses your installed React version.
Use defaultValue or defaultChecked for uncontrolled fields, or a state value and its change callback for controlled fields. Do not switch between these modes during the lifetime of a field.
Modal and notification examples start closed: use their Try buttons to see them. Disabled examples are deliberately non-interactive. Validate forms, uploads, authentication, and server responses in your application; these components only provide UI.