import { Section } from './section'
import { H2, H3, Text, SmallText } from './text'
import { Avatar } from './avatar'
import type { AvatarProps } from './avatar'
import { Image } from './image'
import type { ImageProps } from './image'
import { VStack, HStack } from './stack'
import { Grid } from './grid'
export const Placeholder = {
Avatar(props: PlaceholderAvatarProps) {
const { size = 32, seed = 'seed', type = 'dylan', transparent, alt, style, rounded, id, ref, class: className } = props
// Generate DiceBear avatar URL
const url = new URL(`https://api.dicebear.com/9.x/${type}/svg`)
url.searchParams.set('seed', seed)
url.searchParams.set('size', size.toString())
if (transparent) {
url.searchParams.set('backgroundColor', 'transparent')
}
return
},
Image(props: PlaceholderImageProps) {
const { width = 200, height = 200, seed = 1, alt = 'Placeholder image', objectFit, style, id, ref, class: className } = props
// Generate Picsum Photos URL with seed for consistent images
const src = `https://picsum.photos/${width}/${height}?random=${seed}`
return
},
}
export const Test = () => {
return (
{/* Show all available avatar styles */}
All Avatar Styles ({allStyles.length} total)
{allStyles.slice(0, 12).map((style) => (
{style}
))}
{/* Avatar size variations */}
Avatar Size Variations
{[24, 32, 48, 64].map((size) => (
{size}px
))}
{/* Avatar styling combinations */}
Avatar Styling Options
Rounded + Background
Rounded + Transparent
Square + Background
Square + Transparent
{/* Avatar seed variations */}
Avatar Seeds (Same Style, Different People)
{['alice', 'bob', 'charlie', 'diana'].map((seed) => (
"{seed}"
))}
{/* Placeholder Images */}
Placeholder Images
{/* Size variations */}
Size Variations
{[
{ width: 100, height: 100 },
{ width: 150, height: 100 },
{ width: 200, height: 150 },
{ width: 250, height: 200 },
].map(({ width, height }) => (
{width}x{height}
))}
{/* Different seeds - show variety */}
Different Images (Different Seeds)
{[1, 2, 3, 4, 5].map((seed) => (
Seed {seed}
))}
{/* With custom styles */}
With Custom Styles
Rounded + Border
With Shadow
Circular + Effects
)
}
// Type definitions
type PlaceholderAvatarProps = Omit & {
seed?: string
type?: DicebearStyleName
transparent?: boolean
}
type PlaceholderImageProps = Omit & {
width?: number
height?: number
seed?: number
alt?: string
}
// All supported DiceBear HTTP styleNames. Source: https://www.dicebear.com/styles
const allStyles = [
'adventurer',
'adventurer-neutral',
'avataaars',
'avataaars-neutral',
'big-ears',
'big-ears-neutral',
'big-smile',
'bottts',
'bottts-neutral',
'croodles',
'croodles-neutral',
'dylan',
'fun-emoji',
'glass',
'icons',
'identicon',
'initials',
'lorelei',
'lorelei-neutral',
'micah',
'miniavs',
'notionists',
'notionists-neutral',
'open-peeps',
'personas',
'pixel-art',
'pixel-art-neutral',
'rings',
'shapes',
'thumbs',
] as const
type DicebearStyleName = (typeof allStyles)[number]
// Default export for convenience
export default Placeholder