Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
bec3aa5
feat(bulma-ui): add Avatar, Avatars, and Badge components
bestaxbot Jul 8, 2026
3e2e44c
fix(bulma-ui): stop standalone Badge from being shifted by the corner…
bestaxbot Jul 8, 2026
872778e
fix(bulma-ui): coerce Avatars max to a non-negative integer
bestaxbot Jul 8, 2026
864deec
fix(bulma-ui): apply the five Avatar/Badge review-flagged bugs
bestaxbot Jul 9, 2026
f7f753f
feat(bulma-ui): add imageProps to Avatar
bestaxbot Jul 9, 2026
5b486cf
feat(bulma-ui): accept ReactNode content on Badge
bestaxbot Jul 9, 2026
1172d2e
feat(bulma-ui): add uniform shape, Avatars.Avatar static, and no-poin…
bestaxbot Jul 9, 2026
555141c
feat(bulma-ui): add spaced mode and numeric spacing to Avatars
bestaxbot Jul 9, 2026
10d5549
refactor(bulma-ui): make Avatar/Avatars/Badge SCSS register-vars conf…
bestaxbot Jul 9, 2026
d61344f
test(bulma-ui): fill Avatar/Avatars/Badge test and story gaps
bestaxbot Jul 9, 2026
34191d7
docs(docs): expand Avatar/Avatars/Badge pages per review
bestaxbot Jul 9, 2026
d625c85
docs(bulma-ui): add Avatar/Badge to the theming skill references
bestaxbot Jul 9, 2026
1a0273c
docs(docs): list Avatar, Avatars, and Badge on the components and hom…
bestaxbot Jul 9, 2026
b695637
docs(docs): move Avatar and Badge to Beyond Bulma on the home page
bestaxbot Jul 9, 2026
d68dfcf
style(bulma-ui): replace inline styles with Block + flex helpers in A…
bestaxbot Jul 9, 2026
614a483
style(docs): replace inline flex div with Block in Badge guide example
bestaxbot Jul 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
171 changes: 171 additions & 0 deletions bulma-ui/src/components/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
import type { Meta, StoryObj } from '@storybook/react-vite';
import { Avatar } from './Avatar';
import { Block } from '../elements/Block';
import { Icon } from '../elements/Icon';

const meta: Meta<typeof Avatar> = {
title: 'Components/Avatar',
component: Avatar,
tags: ['autodocs'],
parameters: {
docs: {
description: {
component:
'Represents a person or entity as a compact image, falling back automatically from a photo to initials to an icon.',
},
},
},
argTypes: {
src: {
control: 'text',
description:
'Image URL. On load error (or if absent), falls back to initials, then icon.',
},
alt: {
control: 'text',
description:
'Alternate text for the image (required for meaningful images).',
},
name: {
control: 'text',
description:
'Derives initials and a deterministic background color when no src/initials is shown.',
},
initials: {
control: 'text',
description: 'Explicit initials override (else derived from name).',
},
size: {
control: 'select',
options: [
'16x16',
'24x24',
'32x32',
'48x48',
'64x64',
'96x96',
'128x128',
],
description: 'Preset size, or a pixel size when a number.',
},
shape: {
control: 'select',
options: ['circle', 'rounded', 'square'],
description: 'Avatar shape. Default circle.',
},
color: {
control: 'select',
options: [
'primary',
'link',
'info',
'success',
'warning',
'danger',
'black',
'dark',
'light',
'white',
],
description:
'Background color for initials/icon avatars (else auto-derived from name).',
},
href: {
control: 'text',
description: 'When set, renders the avatar as a link.',
},
},
};
export default meta;
type Story = StoryObj<typeof Avatar>;

export const Photo: Story = {
render: function PhotoExample() {
return (
<Avatar
src="https://bulma.io/assets/images/placeholders/128x128.png"
name="Ada Lovelace"
size="64x64"
/>
);
},
};

export const BrokenImageFallsBackToInitials: Story = {
render: function BrokenImageExample() {
return (
<Avatar src="https://example.invalid/missing.jpg" name="Grace Hopper" />
);
},
};

export const Initials: Story = {
render: function InitialsExample() {
return (
<Block display="flex">
<Avatar name="Ada Lovelace" mr="3" />
<Avatar name="Grace Hopper" mr="3" />
<Avatar name="Katherine Johnson" mr="3" />
<Avatar initials="XY" color="info" />
</Block>
);
},
};

export const IconFallback: Story = {
render: function IconExample() {
return <Avatar icon={<Icon name="user" />} color="info" shape="rounded" />;
},
};

export const DefaultFallback: Story = {
render: function DefaultFallbackExample() {
return <Avatar />;
},
};

export const Shapes: Story = {
render: function ShapesExample() {
return (
<Block display="flex">
<Avatar name="Circle Shape" shape="circle" mr="3" />
<Avatar name="Rounded Shape" shape="rounded" mr="3" />
<Avatar name="Square Shape" shape="square" />
</Block>
);
},
};

export const Sizes: Story = {
render: function SizesExample() {
return (
<Block display="flex" alignItems="center">
<Avatar name="Ada Lovelace" size="16x16" mr="3" />
<Avatar name="Ada Lovelace" size="24x24" mr="3" />
<Avatar name="Ada Lovelace" size="32x32" mr="3" />
<Avatar name="Ada Lovelace" size="48x48" mr="3" />
<Avatar name="Ada Lovelace" size="64x64" mr="3" />
<Avatar name="Ada Lovelace" size={20} />
</Block>
);
},
};

export const Clickable: Story = {
render: function ClickableExample() {
return <Avatar name="Ada Lovelace" href="https://bestax.io" />;
},
};

export const LazyLoadedImage: Story = {
render: function LazyLoadedExample() {
return (
<Avatar
src="https://bulma.io/assets/images/placeholders/128x128.png"
name="Ada Lovelace"
size="64x64"
imageProps={{ loading: 'lazy' }}
/>
);
},
};
Loading
Loading